[ Index ]

PHP Cross Reference of phpBB-3.1.12-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  
  20  class get extends command
  21  {
  22      /**
  23      * {@inheritdoc}
  24      */
  25  	protected function configure()
  26      {
  27          $this
  28              ->setName('config:get')
  29              ->setDescription($this->user->lang('CLI_DESCRIPTION_GET_CONFIG'))
  30              ->addArgument(
  31                  'key',
  32                  InputArgument::REQUIRED,
  33                  $this->user->lang('CLI_CONFIG_OPTION_NAME')
  34              )
  35              ->addOption(
  36                  'no-newline',
  37                  null,
  38                  InputOption::VALUE_NONE,
  39                  $this->user->lang('CLI_CONFIG_PRINT_WITHOUT_NEWLINE')
  40              )
  41          ;
  42      }
  43  
  44      /**
  45      * Executes the command config:get.
  46      *
  47      * Retrieves a configuration value.
  48      *
  49      * @param InputInterface  $input  An InputInterface instance
  50      * @param OutputInterface $output An OutputInterface instance
  51      *
  52      * @return null
  53      * @see \phpbb\config\config::offsetGet()
  54      */
  55  	protected function execute(InputInterface $input, OutputInterface $output)
  56      {
  57          $key = $input->getArgument('key');
  58  
  59          if (isset($this->config[$key]) && $input->getOption('no-newline'))
  60          {
  61              $output->write($this->config[$key]);
  62          }
  63          else if (isset($this->config[$key]))
  64          {
  65              $output->writeln($this->config[$key]);
  66          }
  67          else
  68          {
  69              $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '</error>');
  70          }
  71      }
  72  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1