Display tweets in a table
This commit is contained in:
parent
a02713b644
commit
91af0ef7f8
|
@ -37,6 +37,16 @@ class FetchTweetsCommand extends Command
|
|||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
dump($this->tweetFetcher->getTweets());
|
||||
$io->table(
|
||||
['Tweet', 'Author', 'Created', 'ID'],
|
||||
$this->tweetFetcher->getTweets()->map(function (array $tweet) {
|
||||
return [
|
||||
$tweet['text'],
|
||||
$tweet['author'],
|
||||
$tweet['created'],
|
||||
$tweet['id'],
|
||||
];
|
||||
})->all()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class TweetFetcher
|
|||
|
||||
return collect($response->get('statuses'))
|
||||
->map(function (\stdClass $tweet) {
|
||||
return (object) [
|
||||
return [
|
||||
'id' => $tweet->id,
|
||||
'created' => strtotime($tweet->created_at),
|
||||
'text' => $tweet->text,
|
||||
|
|
Loading…
Reference in a new issue