More tidying.
[yaffs-website] / vendor / drupal / console / src / Command / Develop / ExampleCommand.php
1 <?php
2
3 /**
4  * @file
5  * Contains \Drupal\Console\Develop\Example.
6  */
7
8 namespace Drupal\Console\Command\Develop;
9
10 use Symfony\Component\Console\Input\InputInterface;
11 use Symfony\Component\Console\Output\OutputInterface;
12 use Symfony\Component\Console\Command\Command;
13 use Drupal\Console\Core\Command\Shared\CommandTrait;
14 use Drupal\Console\Core\Style\DrupalStyle;
15
16 /**
17  * Class ExampleCommand
18  *
19  * @package Drupal\Console\Command\Develop
20  */
21 class ExampleCommand extends Command
22 {
23     use CommandTrait;
24     /**
25      * {@inheritdoc}
26      */
27
28     /**
29      * ExampleCommand constructor.
30      */
31     public function __construct()
32     {
33         parent::__construct();
34     }
35
36     protected function configure()
37     {
38         $this->setName('develop:example');
39     }
40
41     /**
42      * {@inheritdoc}
43      */
44     protected function interact(InputInterface $input, OutputInterface $output)
45     {
46     }
47
48     /**
49      * {@inheritdoc}
50      */
51     protected function execute(InputInterface $input, OutputInterface $output)
52     {
53         /* Register your command as a service
54          *
55          * Make sure you register your command class at
56          * config/services/namespace.yml file and add the `drupal.command` tag.
57          *
58          * develop_example:
59          *   class: Drupal\Console\Command\Develop\ExampleCommand
60          *   arguments: ['@service_id', '@console.service_id']
61          *   tags:
62          *     - { name: drupal.command }
63          *
64          * NOTE: Make the proper changes on the namespace and class
65          *       according your new command.
66          *
67          * DrupalConsole extends the SymfonyStyle class to provide
68          * an standardized Output Formatting Style.
69          *
70          * Drupal Console provides the DrupalStyle helper class:
71          */
72         $io = new DrupalStyle($input, $output);
73         $io->simple('This text could be translatable by');
74         $io->simple('adding a YAML file at "config/translations/LANGUAGE/command.name.yml"');
75
76         /**
77          *  Reading user input argument
78          *  $input->getArgument('ARGUMENT_NAME');
79          *
80          *  Reading user input option
81          *  $input->getOption('OPTION_NAME');
82          */
83     }
84 }