Add TweetFetcher as a dependency

This commit is contained in:
Oliver Davies 2019-01-10 14:07:59 +00:00
parent 17d4305c8a
commit f3842bafa1

View file

@ -13,6 +13,18 @@ class FetchTweetsCommand extends Command
{ {
protected static $defaultName = 'app:fetch-tweets'; protected static $defaultName = 'app:fetch-tweets';
/**
* @var \App\Service\TweetFetcher
*/
private $tweetFetcher;
public function __construct(TweetFetcher $tweetFetcher)
{
parent::__construct();
$this->tweetFetcher = $tweetFetcher;
}
protected function configure() protected function configure()
{ {
$this $this
@ -24,6 +36,6 @@ class FetchTweetsCommand extends Command
{ {
$io = new SymfonyStyle($input, $output); $io = new SymfonyStyle($input, $output);
$io->success('You have a new command! Now make it your own! Pass --help to see your options.'); dump($this->tweetFetcher->getTweets());
} }
} }