composer.json in the wrong place. Gone now.
[yaffs-website] / vendor / consolidation / annotated-command / src / Help / HelpCommand.php
1 <?php
2 namespace Consolidation\AnnotatedCommand\Help;
3
4 use Symfony\Component\Console\Application;
5 use Symfony\Component\Console\Descriptor\XmlDescriptor;
6 use Symfony\Component\Console\Input\InputInterface;
7 use Symfony\Component\Console\Output\OutputInterface;
8
9 class HelpCommand
10 {
11     /** var Application */
12     protected $application;
13
14     /**
15      * Create a help document from a Symfony Console command
16      */
17     public function __construct(Application $application)
18     {
19         $this->application = $application;
20     }
21
22     public function getApplication()
23     {
24         return $this->application;
25     }
26
27     /**
28      * Run the help command
29      *
30      * @command my-help
31      * @return \Consolidation\AnnotatedCommand\Help\HelpDocument
32      */
33     public function help($commandName = 'help')
34     {
35         $command = $this->getApplication()->find($commandName);
36
37         $helpDocument = $this->getHelpDocument($command);
38         return $helpDocument;
39     }
40
41     /**
42      * Create a help document.
43      */
44     protected function getHelpDocument($command)
45     {
46         return new HelpDocument($command);
47     }
48 }