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

LazyLoadingFragmentHandler.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 2.43 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\HttpKernel\DependencyInjection;
13   
14  use Psr\Container\ContainerInterface;
15  use Symfony\Component\HttpFoundation\RequestStack;
16  use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
17   
18  /**
19   * Lazily loads fragment renderers from the dependency injection container.
20   *
21   * @author Fabien Potencier <fabien@symfony.com>
22   */
23  class LazyLoadingFragmentHandler extends FragmentHandler
24  {
25      private $container;
26      /**
27       * @deprecated since version 3.3, to be removed in 4.0
28       */
29      private $rendererIds = [];
30      private $initialized = [];
31   
32      /**
33       * @param ContainerInterface $container    A container
34       * @param RequestStack       $requestStack The Request stack that controls the lifecycle of requests
35       * @param bool               $debug        Whether the debug mode is enabled or not
36       */
37      public function __construct(ContainerInterface $container, RequestStack $requestStack, $debug = false)
38      {
39          $this->container = $container;
40   
41          parent::__construct($requestStack, [], $debug);
42      }
43   
44      /**
45       * Adds a service as a fragment renderer.
46       *
47       * @param string $name     The service name
48       * @param string $renderer The render service id
49       *
50       * @deprecated since version 3.3, to be removed in 4.0
51       */
52      public function addRendererService($name, $renderer)
53      {
54          @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED);
55   
56          $this->rendererIds[$name] = $renderer;
57      }
58   
59      /**
60       * {@inheritdoc}
61       */
62      public function render($uri, $renderer = 'inline', array $options = [])
63      {
64          // BC 3.x, to be removed in 4.0
65          if (isset($this->rendererIds[$renderer])) {
66              $this->addRenderer($this->container->get($this->rendererIds[$renderer]));
67              unset($this->rendererIds[$renderer]);
68   
69              return parent::render($uri, $renderer, $options);
70          }
71   
72          if (!isset($this->initialized[$renderer]) && $this->container->has($renderer)) {
73              $this->addRenderer($this->container->get($renderer));
74              $this->initialized[$renderer] = true;
75          }
76   
77          return parent::render($uri, $renderer, $options);
78      }
79  }
80