Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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: 09.10.2024, 12:56 - Dateigröße: 2.35 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\Request;
015  use Symfony\Component\HttpFoundation\Response;
016  use Symfony\Component\HttpFoundation\RedirectResponse;
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      protected $controllers;
027   
028      public function __construct()
029      {
030          $this->controllers = new \SplObjectStorage();
031   
032          $this->data = array(
033              'redirect' => false,
034              'url' => null,
035              'route' => null,
036          );
037      }
038   
039      /**
040       * {@inheritdoc}
041       */
042      public function collect(Request $request, Response $response, \Exception $exception = null)
043      {
044          if ($response instanceof RedirectResponse) {
045              $this->data['redirect'] = true;
046              $this->data['url'] = $response->getTargetUrl();
047   
048              if ($this->controllers->contains($request)) {
049                  $this->data['route'] = $this->guessRoute($request, $this->controllers[$request]);
050              }
051          }
052   
053          unset($this->controllers[$request]);
054      }
055   
056      protected function guessRoute(Request $request, $controller)
057      {
058          return 'n/a';
059      }
060   
061      /**
062       * Remembers the controller associated to each request.
063       *
064       * @param FilterControllerEvent $event The filter controller event
065       */
066      public function onKernelController(FilterControllerEvent $event)
067      {
068          $this->controllers[$event->getRequest()] = $event->getController();
069      }
070   
071      /**
072       * @return bool Whether this request will result in a redirect
073       */
074      public function getRedirect()
075      {
076          return $this->data['redirect'];
077      }
078   
079      /**
080       * @return string|null The target URL
081       */
082      public function getTargetUrl()
083      {
084          return $this->data['url'];
085      }
086   
087      /**
088       * @return string|null The target route
089       */
090      public function getTargetRoute()
091      {
092          return $this->data['route'];
093      }
094   
095      /**
096       * {@inheritdoc}
097       */
098      public function getName()
099      {
100          return 'router';
101      }
102  }
103