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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
DecoratorServicePass.php
01 <?php
02
03 /*
04 * This file is part of the Symfony package.
05 *
06 * (c) Fabien Potencier <fabien@symfony.com>
07 *
08 * For the full copyright and license information, please view the LICENSE
09 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\DependencyInjection\Compiler;
13
14 use Symfony\Component\DependencyInjection\ContainerBuilder;
15 use Symfony\Component\DependencyInjection\Alias;
16
17 /**
18 * Overwrites a service but keeps the overridden one.
19 *
20 * @author Christophe Coevoet <stof@notk.org>
21 * @author Fabien Potencier <fabien@symfony.com>
22 * @author Diego Saint Esteben <diego@saintesteben.me>
23 */
24 class DecoratorServicePass implements CompilerPassInterface
25 {
26 public function process(ContainerBuilder $container)
27 {
28 $definitions = new \SplPriorityQueue();
29 $order = PHP_INT_MAX;
30
31 foreach ($container->getDefinitions() as $id => $definition) {
32 if (!$decorated = $definition->getDecoratedService()) {
33 continue;
34 }
35 $definitions->insert(array($id, $definition), array($decorated[2], --$order));
36 }
37
38 foreach ($definitions as $arr) {
39 list($id, $definition) = $arr;
40 list($inner, $renamedId) = $definition->getDecoratedService();
41
42 $definition->setDecoratedService(null);
43
44 if (!$renamedId) {
45 $renamedId = $id.'.inner';
46 }
47
48 // we create a new alias/service for the service we are replacing
49 // to be able to reference it in the new one
50 if ($container->hasAlias($inner)) {
51 $alias = $container->getAlias($inner);
52 $public = $alias->isPublic();
53 $container->setAlias($renamedId, new Alias((string) $alias, false));
54 } else {
55 $decoratedDefinition = $container->getDefinition($inner);
56 $definition->setTags(array_merge($decoratedDefinition->getTags(), $definition->getTags()));
57 $definition->setAutowiringTypes(array_merge($decoratedDefinition->getAutowiringTypes(), $definition->getAutowiringTypes()));
58 $public = $decoratedDefinition->isPublic();
59 $decoratedDefinition->setPublic(false);
60 $decoratedDefinition->setTags(array());
61 $decoratedDefinition->setAutowiringTypes(array());
62 $container->setDefinition($renamedId, $decoratedDefinition);
63 }
64
65 $container->setAlias($inner, new Alias($id, $public));
66 }
67 }
68 }
69