Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
50.00% covered (danger)
50.00%
1 / 2
CRAP
35.71% covered (danger)
35.71%
5 / 14
AlexisLefebvre\Bundle\AsyncTweetsBundle\Command\StatusesShowCommand
0.00% covered (danger)
0.00%
0 / 1
50.00% covered (danger)
50.00%
1 / 2
3.06
35.71% covered (danger)
35.71%
5 / 14
 configure
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
5 / 5
 execute
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 9
<?php
namespace AlexisLefebvre\Bundle\AsyncTweetsBundle\Command;
use Abraham\TwitterOAuth\TwitterOAuth;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class StatusesShowCommand extends BaseCommand
{
    protected function configure()
    {
        parent::configure();
        $this
            ->setName('statuses:show')
            ->setDescription('Show one tweet (for debugging)')
            ->addArgument('tweet_id', InputArgument::REQUIRED, 'Tweet ID');
    }
    /**
     * @param InputInterface  $input
     * @param OutputInterface $output
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $tweet_id = $input->getArgument('tweet_id');
        $connection = new TwitterOAuth(
            $this->container->getParameter('twitter_consumer_key'),
            $this->container->getParameter('twitter_consumer_secret'),
            $this->container->getParameter('twitter_token'),
            $this->container->getParameter('twitter_token_secret')
        );
        $output->writeln(
            json_encode($connection->get('statuses/show/'.$tweet_id))
        );
    }
}