More updates to stop using dev or alpha or beta versions.
[yaffs-website] / vendor / drush / drush / tests / resources / modules / d8 / woot / src / Commands / GreetCommand.php
1 <?php
2 namespace Drupal\woot\Commands;
3
4 use Symfony\Component\Console\Command\Command;
5 use Symfony\Component\Console\Input\InputArgument;
6 use Symfony\Component\Console\Input\InputInterface;
7 use Symfony\Component\Console\Input\InputOption;
8 use Symfony\Component\Console\Output\OutputInterface;
9
10 /**
11  * This is a literal copy of the example Symfony Console command
12  * from the documentation.
13  *
14  * See: http://symfony.com/doc/2.7/components/console/introduction.html#creating-a-basic-command
15  */
16 class GreetCommand extends Command
17 {
18     protected function configure()
19     {
20         $this
21             ->setName('demo:greet')
22             ->setDescription('Greet someone')
23             ->addArgument(
24                 'name',
25                 InputArgument::OPTIONAL,
26                 'Who do you want to greet?'
27             )
28             ->addOption(
29                 'yell',
30                 null,
31                 InputOption::VALUE_NONE,
32                 'If set, the task will yell in uppercase letters'
33             )
34         ;
35     }
36
37     protected function execute(InputInterface $input, OutputInterface $output)
38     {
39         $name = $input->getArgument('name');
40         if ($name) {
41             $text = 'Hello '.$name;
42         } else {
43             $text = 'Hello';
44         }
45
46         if ($input->getOption('yell')) {
47             $text = strtoupper($text);
48         }
49
50         $output->writeln($text);
51     }
52 }