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

RouterDataCollector.php

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


001  <?php
002   
003  /*
004   * This file is part of the Symfony package.
005   *
006   * (c) Fabien Potencier <fabien@symfony.com>
007   *
008   * For the full copyright and license information, please view the LICENSE
009   * file that was distributed with this source code.
010   */
011   
012  namespace Symfony\Component\HttpKernel\DataCollector;
013   
014  use Symfony\Component\HttpFoundation\RedirectResponse;
015  use Symfony\Component\HttpFoundation\Request;
016  use Symfony\Component\HttpFoundation\Response;
017  use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
018   
019  /**
020   * RouterDataCollector.
021   *
022   * @author Fabien Potencier <fabien@symfony.com>
023   */
024  class RouterDataCollector extends DataCollector
025  {
026      /**
027       * @var \SplObjectStorage
028       */
029      protected $controllers;
030   
031      public function __construct()
032      {
033          $this->reset();
034      }
035   
036      /**
037       * {@inheritdoc}
038       */
039      public function collect(Request $request, Response $response, \Exception $exception = null)
040      {
041          if ($response instanceof RedirectResponse) {
042              $this->data['redirect'] = true;
043              $this->data['url'] = $response->getTargetUrl();
044   
045              if ($this->controllers->contains($request)) {
046                  $this->data['route'] = $this->guessRoute($request, $this->controllers[$request]);
047              }
048          }
049   
050          unset($this->controllers[$request]);
051      }
052   
053      public function reset()
054      {
055          $this->controllers = new \SplObjectStorage();
056   
057          $this->data = [
058              'redirect' => false,
059              'url' => null,
060              'route' => null,
061          ];
062      }
063   
064      protected function guessRoute(Request $request, $controller)
065      {
066          return 'n/a';
067      }
068   
069      /**
070       * Remembers the controller associated to each request.
071       */
072      public function onKernelController(FilterControllerEvent $event)
073      {
074          $this->controllers[$event->getRequest()] = $event->getController();
075      }
076   
077      /**
078       * @return bool Whether this request will result in a redirect
079       */
080      public function getRedirect()
081      {
082          return $this->data['redirect'];
083      }
084   
085      /**
086       * @return string|null The target URL
087       */
088      public function getTargetUrl()
089      {
090          return $this->data['url'];
091      }
092   
093      /**
094       * @return string|null The target route
095       */
096      public function getTargetRoute()
097      {
098          return $this->data['route'];
099      }
100   
101      /**
102       * {@inheritdoc}
103       */
104      public function getName()
105      {
106          return 'router';
107      }
108  }
109