Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

service_collection.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 1.97 KiB


001  <?php
002  /**
003  *
004  * This file is part of the phpBB Forum Software package.
005  *
006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
007  * @license GNU General Public License, version 2 (GPL-2.0)
008  *
009  * For full copyright and license information, please see
010  * the docs/CREDITS.txt file.
011  *
012  */
013   
014  namespace phpbb\di;
015   
016  use Symfony\Component\DependencyInjection\ContainerInterface;
017   
018  /**
019  * Collection of services to be configured at container compile time.
020  */
021  class service_collection extends \ArrayObject
022  {
023      /**
024      * @var \Symfony\Component\DependencyInjection\ContainerInterface
025      */
026      protected $container;
027   
028      /**
029      * @var array
030      */
031      protected $service_classes;
032   
033      /**
034      * Constructor
035      *
036      * @param ContainerInterface $container Container object
037      */
038      public function __construct(ContainerInterface $container)
039      {
040          $this->container = $container;
041          $this->service_classes = array();
042      }
043   
044      /**
045      * {@inheritdoc}
046      */
047      public function getIterator()
048      {
049          return new service_collection_iterator($this);
050      }
051   
052      // Because of a PHP issue we have to redefine offsetExists
053      // (even with a call to the parent):
054      //         https://bugs.php.net/bug.php?id=66834
055      //         https://bugs.php.net/bug.php?id=67067
056      // But it triggers a sniffer issue that we have to skip
057      // @codingStandardsIgnoreStart
058      /**
059      * {@inheritdoc}
060      */
061      public function offsetExists($index)
062      {
063          return parent::offsetExists($index);
064      }
065      // @codingStandardsIgnoreEnd
066   
067      /**
068      * {@inheritdoc}
069      */
070      public function offsetGet($index)
071      {
072          return $this->container->get($index);
073      }
074   
075      /**
076      * Add a service to the collection
077      *
078      * @param string $name The service name
079      * @return null
080      */
081      public function add($name)
082      {
083          $this->offsetSet($name, null);
084      }
085   
086      /**
087      * Add a service's class to the collection
088      *
089      * @param string    $service_id
090      * @param string    $class
091      */
092      public function add_service_class($service_id, $class)
093      {
094          $this->service_classes[$service_id] = $class;
095      }
096   
097      /**
098      * Get services' classes
099      *
100      * @return array
101      */
102      public function get_service_classes()
103      {
104          return $this->service_classes;
105      }
106  }
107