Added the Porter Stemmer module to improve searches. This doesn't deal with some...
[yaffs-website] / vendor / symfony / event-dispatcher / Debug / WrappedListener.php
index 45208a19b2440fa8d8023a0797cae61fecc39590..2d8126a65d6be04109208f312c089f1934d7cb53 100644 (file)
 
 namespace Symfony\Component\EventDispatcher\Debug;
 
-use Symfony\Component\Stopwatch\Stopwatch;
 use Symfony\Component\EventDispatcher\Event;
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\Stopwatch\Stopwatch;
 use Symfony\Component\VarDumper\Caster\ClassStub;
-use Symfony\Component\VarDumper\Cloner\VarCloner;
 
 /**
  * @author Fabien Potencier <fabien@symfony.com>
@@ -29,9 +28,8 @@ class WrappedListener
     private $stopwatch;
     private $dispatcher;
     private $pretty;
-    private $data;
-
-    private static $cloner;
+    private $stub;
+    private static $hasClassStub;
 
     public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null)
     {
@@ -42,15 +40,15 @@ class WrappedListener
         $this->called = false;
         $this->stoppedPropagation = false;
 
-        if (is_array($listener)) {
-            $this->name = is_object($listener[0]) ? get_class($listener[0]) : $listener[0];
+        if (\is_array($listener)) {
+            $this->name = \is_object($listener[0]) ? \get_class($listener[0]) : $listener[0];
             $this->pretty = $this->name.'::'.$listener[1];
         } elseif ($listener instanceof \Closure) {
             $this->pretty = $this->name = 'closure';
-        } elseif (is_string($listener)) {
+        } elseif (\is_string($listener)) {
             $this->pretty = $this->name = $listener;
         } else {
-            $this->name = get_class($listener);
+            $this->name = \get_class($listener);
             $this->pretty = $this->name.'::__invoke';
         }
 
@@ -58,8 +56,8 @@ class WrappedListener
             $this->name = $name;
         }
 
-        if (null === self::$cloner) {
-            self::$cloner = class_exists(ClassStub::class) ? new VarCloner() : false;
+        if (null === self::$hasClassStub) {
+            self::$hasClassStub = class_exists(ClassStub::class);
         }
     }
 
@@ -85,15 +83,15 @@ class WrappedListener
 
     public function getInfo($eventName)
     {
-        if (null === $this->data) {
-            $this->data = false !== self::$cloner ? self::$cloner->cloneVar(array(new ClassStub($this->pretty.'()', $this->listener)))->seek(0) : $this->pretty;
+        if (null === $this->stub) {
+            $this->stub = self::$hasClassStub ? new ClassStub($this->pretty.'()', $this->listener) : $this->pretty.'()';
         }
 
         return array(
             'event' => $eventName,
             'priority' => null !== $this->dispatcher ? $this->dispatcher->getListenerPriority($eventName, $this->listener) : null,
             'pretty' => $this->pretty,
-            'data' => $this->data,
+            'stub' => $this->stub,
         );
     }
 
@@ -103,7 +101,7 @@ class WrappedListener
 
         $e = $this->stopwatch->start($this->name, 'event_listener');
 
-        call_user_func($this->listener, $event, $eventName, $this->dispatcher ?: $dispatcher);
+        \call_user_func($this->listener, $event, $eventName, $this->dispatcher ?: $dispatcher);
 
         if ($e->isStarted()) {
             $e->stop();