for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by PhpStorm.
* User: oguzu
* Date: 29-3-2017
* Time: 16:11
*/
namespace Pbxg33k\MusicInfo\Command;
use Pbxg33k\MusicInfo\MusicInfo;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class SearchTrackCommand extends BaseCommand
{
const COMMAND_NAME = 'search:track';
const COMMAND_DESCRIPTION = 'Search a track on one or more services';
* @var MusicInfo
protected $musicInfo;
protected function configure()
$this
->addArgument('track', InputArgument::REQUIRED, 'Artist Name')
->addArgument('service', InputArgument::OPTIONAL, 'Service to use, default to all enabled');
parent::configure(); // TODO: Change the autogenerated stub
}
public function execute(InputInterface $input, OutputInterface $output)
$service = ($input->getArgument('service') != '') ? $input->getArgument('service') : null;
$searchResults = $this->musicInfo->doSearch($input->getArgument('track'), 'track', $service);
$resultsTable = $this->generateTableForSearchResult(
$searchResults, [
'id' => 'ID',
'name' => 'Name',
'image' => 'Image URL',
'length'=> 'Duration',
'type' => 'Type',
'dataSource' => 'Source',
'uri' => 'URL'
], new Table($output)
);
$resultsTable->render();