Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

HelpCommand.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 2.52 KiB


01  <?php
02   
03  /*
04   * This file is part of the Symfony package.
05   *
06   * (c) Fabien Potencier <fabien@symfony.com>
07   *
08   * For the full copyright and license information, please view the LICENSE
09   * file that was distributed with this source code.
10   */
11   
12  namespace Symfony\Component\Console\Command;
13   
14  use Symfony\Component\Console\Helper\DescriptorHelper;
15  use Symfony\Component\Console\Input\InputArgument;
16  use Symfony\Component\Console\Input\InputOption;
17  use Symfony\Component\Console\Input\InputInterface;
18  use Symfony\Component\Console\Output\OutputInterface;
19   
20  /**
21   * HelpCommand displays the help for a given command.
22   *
23   * @author Fabien Potencier <fabien@symfony.com>
24   */
25  class HelpCommand extends Command
26  {
27      private $command;
28   
29      /**
30       * {@inheritdoc}
31       */
32      protected function configure()
33      {
34          $this->ignoreValidationErrors();
35   
36          $this
37              ->setName('help')
38              ->setDefinition(array(
39                  new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
40                  new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
41                  new InputOption('format', null, InputOption::VALUE_REQUIRED, 'To output help in other formats'),
42                  new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
43              ))
44              ->setDescription('Displays help for a command')
45              ->setHelp(<<<EOF
46  The <info>%command.name%</info> command displays help for a given command:
47   
48    <info>php %command.full_name% list</info>
49   
50  You can also output the help in other formats by using the <comment>--format</comment> option:
51   
52    <info>php %command.full_name% --format=xml list</info>
53   
54  To display the list of available commands, please use the <info>list</info> command.
55  EOF
56              )
57          ;
58      }
59   
60      /**
61       * Sets the command
62       *
63       * @param Command $command The command to set
64       */
65      public function setCommand(Command $command)
66      {
67          $this->command = $command;
68      }
69   
70      /**
71       * {@inheritdoc}
72       */
73      protected function execute(InputInterface $input, OutputInterface $output)
74      {
75          if (null === $this->command) {
76              $this->command = $this->getApplication()->find($input->getArgument('command_name'));
77          }
78   
79          if ($input->getOption('xml')) {
80              $input->setOption('format', 'xml');
81          }
82   
83          $helper = new DescriptorHelper();
84          $helper->describe($output, $this->command, $input->getOption('format'), $input->getOption('raw'));
85          $this->command = null;
86      }
87  }
88