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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

ResolveServiceSubscribersPass.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 1.51 KiB


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 Psr\Container\ContainerInterface;
15  use Symfony\Component\DependencyInjection\Definition;
16  use Symfony\Component\DependencyInjection\Reference;
17   
18  /**
19   * Compiler pass to inject their service locator to service subscribers.
20   *
21   * @author Nicolas Grekas <p@tchwork.com>
22   */
23  class ResolveServiceSubscribersPass extends AbstractRecursivePass
24  {
25      private $serviceLocator;
26   
27      protected function processValue($value, $isRoot = false)
28      {
29          if ($value instanceof Reference && $this->serviceLocator && ContainerInterface::class === $this->container->normalizeId($value)) {
30              return new Reference($this->serviceLocator);
31          }
32   
33          if (!$value instanceof Definition) {
34              return parent::processValue($value, $isRoot);
35          }
36   
37          $serviceLocator = $this->serviceLocator;
38          $this->serviceLocator = null;
39   
40          if ($value->hasTag('container.service_subscriber.locator')) {
41              $this->serviceLocator = $value->getTag('container.service_subscriber.locator')[0]['id'];
42              $value->clearTag('container.service_subscriber.locator');
43          }
44   
45          try {
46              return parent::processValue($value);
47          } finally {
48              $this->serviceLocator = $serviceLocator;
49          }
50      }
51  }
52