Verzeichnisstruktur phpBB-3.1.0
- Veröffentlicht
- 27.10.2014
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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
service_collection.php
01 <?php
02 /**
03 *
04 * This file is part of the phpBB Forum Software package.
05 *
06 * @copyright (c) phpBB Limited <https://www.phpbb.com>
07 * @license GNU General Public License, version 2 (GPL-2.0)
08 *
09 * 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 }
80