[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/report/ -> handler_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\report;
  15  
  16  use phpbb\report\exception\factory_invalid_argument_exception;
  17  
  18  class handler_factory
  19  {
  20      /**
  21       * @var \Symfony\Component\DependencyInjection\ContainerInterface
  22       */
  23      protected $container;
  24  
  25      /**
  26       * Constructor
  27       *
  28       * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
  29       */
  30  	public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container)
  31      {
  32          $this->container = $container;
  33      }
  34  
  35      /**
  36       * Return a new instance of an appropriate report handler
  37       *
  38       * @param string    $type
  39       * @return \phpbb\report\report_handler_interface
  40       * @throws factory_invalid_argument_exception if $type is not valid
  41       */
  42  	public function get_instance($type)
  43      {
  44          switch ($type)
  45          {
  46              case 'pm':
  47                  return $this->container->get('phpbb.report.handlers.report_handler_pm');
  48              break;
  49              case 'post':
  50                  return $this->container->get('phpbb.report.handlers.report_handler_post');
  51              break;
  52          }
  53  
  54          throw new factory_invalid_argument_exception();
  55      }
  56  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1