[ Index ]

PHP Cross Reference of phpBB-3.3.3-deutsch

title

Body

[close]

/phpbb/install/helper/iohandler/ -> factory.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  
  14  namespace phpbb\install\helper\iohandler;
  15  
  16  use phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception;
  17  
  18  /**
  19   * Input-output handler factory
  20   */
  21  class factory
  22  {
  23      /**
  24       * @var \Symfony\Component\DependencyInjection\ContainerInterface
  25       */
  26      protected $container;
  27  
  28      /**
  29       * @var string
  30       */
  31      protected $environment;
  32  
  33      /**
  34       * Constructor
  35       *
  36       * @param \Symfony\Component\DependencyInjection\ContainerInterface $container Dependency injection container
  37       */
  38  	public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container)
  39      {
  40          $this->container    = $container;
  41          $this->environment    = null;
  42      }
  43  
  44      /**
  45       * @param string    $environment    The name of the input-output handler to use
  46       */
  47  	public function set_environment($environment)
  48      {
  49          $this->environment = $environment;
  50      }
  51  
  52      /**
  53       * Factory getter for iohandler
  54       *
  55       * @return \phpbb\install\helper\iohandler\iohandler_interface
  56       *
  57       * @throws \phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception
  58       *         When the specified iohandler_interface does not exists
  59       */
  60  	public function get()
  61      {
  62          switch ($this->environment)
  63          {
  64              case 'ajax':
  65                  return $this->container->get('installer.helper.iohandler_ajax');
  66              break;
  67              case 'nojs':
  68                  // @todo replace this
  69                  return $this->container->get('installer.helper.iohandler_ajax');
  70              break;
  71              case 'cli':
  72                  return $this->container->get('installer.helper.iohandler_cli');
  73              break;
  74              default:
  75                  throw new iohandler_not_implemented_exception();
  76              break;
  77          }
  78      }
  79  }


Generated: Sun Feb 14 20:08:31 2021 Cross-referenced by PHPXref 0.7.1