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 |
CheckExceptionOnInvalidReferenceBehaviorPass.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\Definition;
15
16 use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
17 use Symfony\Component\DependencyInjection\ContainerInterface;
18 use Symfony\Component\DependencyInjection\Reference;
19 use Symfony\Component\DependencyInjection\ContainerBuilder;
20
21 /**
22 * Checks that all references are pointing to a valid service.
23 *
24 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
25 */
26 class CheckExceptionOnInvalidReferenceBehaviorPass implements CompilerPassInterface
27 {
28 private $container;
29 private $sourceId;
30
31 public function process(ContainerBuilder $container)
32 {
33 $this->container = $container;
34
35 foreach ($container->getDefinitions() as $id => $definition) {
36 $this->sourceId = $id;
37 $this->processDefinition($definition);
38 }
39 }
40
41 private function processDefinition(Definition $definition)
42 {
43 $this->processReferences($definition->getArguments());
44 $this->processReferences($definition->getMethodCalls());
45 $this->processReferences($definition->getProperties());
46 }
47
48 private function processReferences(array $arguments)
49 {
50 foreach ($arguments as $argument) {
51 if (is_array($argument)) {
52 $this->processReferences($argument);
53 } elseif ($argument instanceof Definition) {
54 $this->processDefinition($argument);
55 } elseif ($argument instanceof Reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $argument->getInvalidBehavior()) {
56 $destId = (string) $argument;
57
58 if (!$this->container->has($destId)) {
59 throw new ServiceNotFoundException($destId, $this->sourceId);
60 }
61 }
62 }
63 }
64 }
65