From e8ad0b9b914021fc32e4c847b140aa961f5d64bb Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 10 Jan 2019 23:15:45 +0000 Subject: [PATCH] Add method for retweeting --- src/Command/RetweetTweetsCommand.php | 2 +- src/Service/Retweeter.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Command/RetweetTweetsCommand.php b/src/Command/RetweetTweetsCommand.php index c717d7d..8e08088 100644 --- a/src/Command/RetweetTweetsCommand.php +++ b/src/Command/RetweetTweetsCommand.php @@ -37,7 +37,7 @@ class RetweetTweetsCommand extends Command protected function execute(InputInterface $input, OutputInterface $output) { $this->tweetFetcher->getTweets()->each(function (array $tweet) { - $this->retweeter->retweet(); + $this->retweeter->retweet($tweet); }); } } diff --git a/src/Service/Retweeter.php b/src/Service/Retweeter.php index b89c7f8..d32594b 100644 --- a/src/Service/Retweeter.php +++ b/src/Service/Retweeter.php @@ -25,4 +25,11 @@ class Retweeter $this->codebird = $codebird; } + + public function retweet(array $tweet): void + { + $this->codebird->statuses_retweet_ID([ + 'id' => $tweet['id'], + ]); + } }