for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Ps2alerts\Api\Command;
use Ps2alerts\Api\Command\BaseCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class TestCommand extends BaseCommand
{
protected $config;
protected function configure()
parent::configure(); // See BaseCommand.php
$this
->setName('testCommand')
->setDescription('Greet someone')
->addArgument(
'name',
InputArgument::OPTIONAL,
'Who do you want to greet?'
)
->addOption(
'yell',
null,
InputOption::VALUE_NONE,
'If set, the task will yell in uppercase letters'
);
$this->config = $this->container->get('config');
}
protected function execute(InputInterface $input, OutputInterface $output)
$name = $input->getArgument('name');
if ($name) {
$text = 'Hello '.$name;
} else {
$text = 'Hello';
if ($input->getOption('yell')) {
$text = strtoupper($text);
$output->writeln($text);
// Should echo #logs unless it's been changed
$output->writeln($this->config['slack_channel']);