minor #35314 [SecurityBundle] Drop duplicated code (chalasr)

This PR was merged into the 4.4 branch.

Discussion
----------

[SecurityBundle] Drop duplicated code

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

ffbf31d8c6 [SecurityBundle] Drop duplicated code
This commit is contained in:
Robin Chalas 2020-01-12 18:08:56 +01:00
commit 642c7ffed8
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),
];
}
} }