[SecurityBundle] Drop duplicated code

This commit is contained in:
Robin Chalas 2020-01-10 23:55:24 +01:00
parent 8e0f0cc990
commit ffbf31d8c6
3 changed files with 10 additions and 20 deletions

View File

@ -12,6 +12,7 @@
namespace Symfony\Bundle\SecurityBundle\Debug; namespace Symfony\Bundle\SecurityBundle\Debug;
use Symfony\Component\Security\Http\Firewall\LegacyListenerTrait; use Symfony\Component\Security\Http\Firewall\LegacyListenerTrait;
use Symfony\Component\VarDumper\Caster\ClassStub;
/** /**
* @author Robin Chalas <robin.chalas@gmail.com> * @author Robin Chalas <robin.chalas@gmail.com>
@ -39,4 +40,13 @@ trait TraceableListenerTrait
{ {
return $this->listener; return $this->listener;
} }
public function getInfo(): array
{
return [
'response' => $this->response,
'time' => $this->time,
'stub' => $this->stub ?? $this->stub = ClassStub::wrapCallable($this->listener),
];
}
} }

View File

@ -16,7 +16,6 @@ use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\Security\Core\Exception\LazyResponseException; use Symfony\Component\Security\Core\Exception\LazyResponseException;
use Symfony\Component\Security\Http\Firewall\AbstractListener; use Symfony\Component\Security\Http\Firewall\AbstractListener;
use Symfony\Component\Security\Http\Firewall\ListenerInterface; use Symfony\Component\Security\Http\Firewall\ListenerInterface;
use Symfony\Component\VarDumper\Caster\ClassStub;
/** /**
* Wraps a lazy security listener. * Wraps a lazy security listener.
@ -60,13 +59,4 @@ final class WrappedLazyListener extends AbstractListener implements ListenerInte
return $ret; return $ret;
} }
public function getInfo(): array
{
return [
'response' => $this->response,
'time' => $this->time,
'stub' => $this->stub ?? $this->stub = ClassStub::wrapCallable($this->listener),
];
}
} }

View File

@ -13,7 +13,6 @@ namespace Symfony\Bundle\SecurityBundle\Debug;
use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\Security\Http\Firewall\ListenerInterface; use Symfony\Component\Security\Http\Firewall\ListenerInterface;
use Symfony\Component\VarDumper\Caster\ClassStub;
/** /**
* Wraps a security listener for calls record. * Wraps a security listener for calls record.
@ -49,13 +48,4 @@ final class WrappedListener implements ListenerInterface
$this->time = microtime(true) - $startTime; $this->time = microtime(true) - $startTime;
$this->response = $event->getResponse(); $this->response = $event->getResponse();
} }
public function getInfo(): array
{
return [
'response' => $this->response,
'time' => $this->time,
'stub' => $this->stub ?? $this->stub = ClassStub::wrapCallable($this->listener),
];
}
} }