Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
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 |
ResolveReferencesToAliasesPass.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\Exception\ServiceCircularReferenceException;
16 use Symfony\Component\DependencyInjection\Reference;
17
18 /**
19 * Replaces all references to aliases with references to the actual service.
20 *
21 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
22 */
23 class ResolveReferencesToAliasesPass extends AbstractRecursivePass
24 {
25 /**
26 * {@inheritdoc}
27 */
28 public function process(ContainerBuilder $container)
29 {
30 parent::process($container);
31
32 foreach ($container->getAliases() as $id => $alias) {
33 $aliasId = $container->normalizeId($alias);
34 if ($aliasId !== $defId = $this->getDefinitionId($aliasId, $container)) {
35 $container->setAlias($id, $defId)->setPublic($alias->isPublic())->setPrivate($alias->isPrivate());
36 }
37 }
38 }
39
40 /**
41 * {@inheritdoc}
42 */
43 protected function processValue($value, $isRoot = false)
44 {
45 if ($value instanceof Reference) {
46 $defId = $this->getDefinitionId($id = $this->container->normalizeId($value), $this->container);
47
48 if ($defId !== $id) {
49 return new Reference($defId, $value->getInvalidBehavior());
50 }
51 }
52
53 return parent::processValue($value);
54 }
55
56 /**
57 * Resolves an alias into a definition id.
58 *
59 * @param string $id The definition or alias id to resolve
60 *
61 * @return string The definition id with aliases resolved
62 */
63 private function getDefinitionId($id, ContainerBuilder $container)
64 {
65 $seen = [];
66 while ($container->hasAlias($id)) {
67 if (isset($seen[$id])) {
68 throw new ServiceCircularReferenceException($id, array_merge(array_keys($seen), [$id]));
69 }
70 $seen[$id] = true;
71 $id = $container->normalizeId($container->getAlias($id));
72 }
73
74 return $id;
75 }
76 }
77