[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/console/src/Command/ -> ListCommand.php (source)

   1  <?php
   2  /**
   3   * Part of the Joomla Framework Console Package
   4   *
   5   * @copyright  Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
   6   * @license    GNU General Public License version 2 or later; see LICENSE
   7   */
   8  
   9  namespace Joomla\Console\Command;
  10  
  11  use Joomla\Console\Helper\DescriptorHelper;
  12  use Symfony\Component\Console\Input\InputArgument;
  13  use Symfony\Component\Console\Input\InputInterface;
  14  use Symfony\Component\Console\Output\OutputInterface;
  15  
  16  /**
  17   * Command listing all available commands.
  18   *
  19   * @since  2.0.0
  20   */
  21  class ListCommand extends AbstractCommand
  22  {
  23      /**
  24       * The default command name
  25       *
  26       * @var    string
  27       * @since  2.0.0
  28       */
  29      protected static $defaultName = 'list';
  30  
  31      /**
  32       * Configure the command.
  33       *
  34       * @return  void
  35       *
  36       * @since   2.0.0
  37       */
  38  	protected function configure(): void
  39      {
  40          $this->setDescription("List the application's available commands");
  41          $this->addArgument('namespace', InputArgument::OPTIONAL, 'The namespace name');
  42          $this->setHelp(<<<'EOF'
  43  The <info>%command.name%</info> command lists all of the application's commands:
  44  
  45    <info>php %command.full_name%</info>
  46  EOF
  47          );
  48      }
  49  
  50      /**
  51       * Internal function to execute the command.
  52       *
  53       * @param   InputInterface   $input   The input to inject into the command.
  54       * @param   OutputInterface  $output  The output to inject into the command.
  55       *
  56       * @return  integer  The command exit code
  57       *
  58       * @since   2.0.0
  59       */
  60  	protected function doExecute(InputInterface $input, OutputInterface $output): int
  61      {
  62          $descriptor = new DescriptorHelper;
  63  
  64          if ($this->getHelperSet() !== null)
  65          {
  66              $this->getHelperSet()->set($descriptor);
  67          }
  68  
  69          $descriptor->describe(
  70              $output,
  71              $this->getApplication(),
  72              [
  73                  'namespace' => $input->getArgument('namespace'),
  74              ]
  75          );
  76  
  77          return 0;
  78      }
  79  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer