Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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

WrappedListener.php

Zuletzt modifiziert: 01.05.2026, 11:26 - Dateigröße: 3.60 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\EventDispatcher\Debug;
 013   
 014  use Symfony\Component\EventDispatcher\Event;
 015  use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 016  use Symfony\Component\Stopwatch\Stopwatch;
 017  use Symfony\Component\VarDumper\Caster\ClassStub;
 018   
 019  /**
 020   * @author Fabien Potencier <fabien@symfony.com>
 021   */
 022  class WrappedListener
 023  {
 024      private $listener;
 025      private $name;
 026      private $called;
 027      private $stoppedPropagation;
 028      private $stopwatch;
 029      private $dispatcher;
 030      private $pretty;
 031      private $stub;
 032      private $priority;
 033      private static $hasClassStub;
 034   
 035      public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null)
 036      {
 037          $this->listener = $listener;
 038          $this->stopwatch = $stopwatch;
 039          $this->dispatcher = $dispatcher;
 040          $this->called = false;
 041          $this->stoppedPropagation = false;
 042   
 043          if (\is_array($listener)) {
 044              $this->name = \is_object($listener[0]) ? \get_class($listener[0]) : $listener[0];
 045              $this->pretty = $this->name.'::'.$listener[1];
 046          } elseif ($listener instanceof \Closure) {
 047              $r = new \ReflectionFunction($listener);
 048              if (false !== strpos($r->name, '{closure}')) {
 049                  $this->pretty = $this->name = 'closure';
 050              } elseif ($class = $r->getClosureScopeClass()) {
 051                  $this->name = $class->name;
 052                  $this->pretty = $this->name.'::'.$r->name;
 053              } else {
 054                  $this->pretty = $this->name = $r->name;
 055              }
 056          } elseif (\is_string($listener)) {
 057              $this->pretty = $this->name = $listener;
 058          } else {
 059              $this->name = \get_class($listener);
 060              $this->pretty = $this->name.'::__invoke';
 061          }
 062   
 063          if (null !== $name) {
 064              $this->name = $name;
 065          }
 066   
 067          if (null === self::$hasClassStub) {
 068              self::$hasClassStub = class_exists(ClassStub::class);
 069          }
 070      }
 071   
 072      public function getWrappedListener()
 073      {
 074          return $this->listener;
 075      }
 076   
 077      public function wasCalled()
 078      {
 079          return $this->called;
 080      }
 081   
 082      public function stoppedPropagation()
 083      {
 084          return $this->stoppedPropagation;
 085      }
 086   
 087      public function getPretty()
 088      {
 089          return $this->pretty;
 090      }
 091   
 092      public function getInfo($eventName)
 093      {
 094          if (null === $this->stub) {
 095              $this->stub = self::$hasClassStub ? new ClassStub($this->pretty.'()', $this->listener) : $this->pretty.'()';
 096          }
 097   
 098          return [
 099              'event' => $eventName,
 100              'priority' => null !== $this->priority ? $this->priority : (null !== $this->dispatcher ? $this->dispatcher->getListenerPriority($eventName, $this->listener) : null),
 101              'pretty' => $this->pretty,
 102              'stub' => $this->stub,
 103          ];
 104      }
 105   
 106      public function __invoke(Event $event, $eventName, EventDispatcherInterface $dispatcher)
 107      {
 108          $dispatcher = $this->dispatcher ?: $dispatcher;
 109   
 110          $this->called = true;
 111          $this->priority = $dispatcher->getListenerPriority($eventName, $this->listener);
 112   
 113          $e = $this->stopwatch->start($this->name, 'event_listener');
 114   
 115          \call_user_func($this->listener, $event, $eventName, $dispatcher);
 116   
 117          if ($e->isStarted()) {
 118              $e->stop();
 119          }
 120   
 121          if ($event->isPropagationStopped()) {
 122              $this->stoppedPropagation = true;
 123          }
 124      }
 125  }
 126