[ Index ]

PHP Cross Reference of phpBB-3.3.11-deutsch

title

Body

[close]

/phpbb/console/command/config/ -> get.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  namespace phpbb\console\command\config;
  14  
  15  use Symfony\Component\Console\Input\InputArgument;
  16  use Symfony\Component\Console\Input\InputInterface;
  17  use Symfony\Component\Console\Input\InputOption;
  18  use Symfony\Component\Console\Output\OutputInterface;
  19  use Symfony\Component\Console\Style\SymfonyStyle;
  20  
  21  class get extends command
  22  {
  23      /**
  24      * {@inheritdoc}
  25      */
  26  	protected function configure()
  27      {
  28          $this
  29              ->setName('config:get')
  30              ->setDescription($this->user->lang('CLI_DESCRIPTION_GET_CONFIG'))
  31              ->addArgument(
  32                  'key',
  33                  InputArgument::REQUIRED,
  34                  $this->user->lang('CLI_CONFIG_OPTION_NAME')
  35              )
  36              ->addOption(
  37                  'no-newline',
  38                  null,
  39                  InputOption::VALUE_NONE,
  40                  $this->user->lang('CLI_CONFIG_PRINT_WITHOUT_NEWLINE')
  41              )
  42          ;
  43      }
  44  
  45      /**
  46      * Executes the command config:get.
  47      *
  48      * Retrieves a configuration value.
  49      *
  50      * @param InputInterface  $input  An InputInterface instance
  51      * @param OutputInterface $output An OutputInterface instance
  52      *
  53      * @return void
  54      * @see \phpbb\config\config::offsetGet()
  55      */
  56  	protected function execute(InputInterface $input, OutputInterface $output)
  57      {
  58          $io = new SymfonyStyle($input, $output);
  59  
  60          $key = $input->getArgument('key');
  61  
  62          if (isset($this->config[$key]) && $input->getOption('no-newline'))
  63          {
  64              $output->write($this->config[$key]);
  65          }
  66          else if (isset($this->config[$key]))
  67          {
  68              $output->writeln($this->config[$key]);
  69          }
  70          else
  71          {
  72              $io->error($this->user->lang('CLI_CONFIG_NOT_EXISTS', $key));
  73          }
  74      }
  75  }


Generated: Sat Nov 4 14:26:03 2023 Cross-referenced by PHPXref 0.7.1