[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/phpbb/di/ -> service_collection.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\di;
  15  
  16  use Symfony\Component\DependencyInjection\ContainerInterface;
  17  
  18  /**
  19  * Collection of services to be configured at container compile time.
  20  */
  21  class service_collection extends \ArrayObject
  22  {
  23      /**
  24      * @var \Symfony\Component\DependencyInjection\ContainerInterface
  25      */
  26      protected $container;
  27  
  28      /**
  29      * Constructor
  30      *
  31      * @param ContainerInterface $container Container object
  32      */
  33  	public function __construct(ContainerInterface $container)
  34      {
  35          $this->container = $container;
  36      }
  37  
  38      /**
  39      * {@inheritdoc}
  40      */
  41  	public function getIterator()
  42      {
  43          return new service_collection_iterator($this);
  44      }
  45  
  46      // Because of a PHP issue we have to redefine offsetExists
  47      // (even with a call to the parent):
  48      //         https://bugs.php.net/bug.php?id=66834
  49      //         https://bugs.php.net/bug.php?id=67067
  50      // But it triggers a sniffer issue that we have to skip
  51      // @codingStandardsIgnoreStart
  52      /**
  53      * {@inheritdoc}
  54      */
  55  	public function offsetExists($index)
  56      {
  57          return parent::offsetExists($index);
  58      }
  59      // @codingStandardsIgnoreEnd
  60  
  61      /**
  62      * {@inheritdoc}
  63      */
  64  	public function offsetGet($index)
  65      {
  66          return $this->container->get($index);
  67      }
  68  
  69      /**
  70      * Add a service to the collection
  71      *
  72      * @param string $name The service name
  73      * @return null
  74      */
  75  	public function add($name)
  76      {
  77          $this->offsetSet($name, null);
  78      }
  79  }


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