-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 3.4: [FrameworkBundle] Deprecate useless --no-prefix option Add Doctrine Cache to dev dependencies to fix failing unit tests. Give info about called security listeners in profiler Fix the usage of FrameworkBundle in debug mode without Stopwatch
- Loading branch information
Showing
17 changed files
with
330 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/Symfony/Bundle/SecurityBundle/Debug/TraceableFirewallListener.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bundle\SecurityBundle\Debug; | ||
|
||
use Symfony\Bundle\SecurityBundle\EventListener\FirewallListener; | ||
use Symfony\Component\HttpKernel\Event\GetResponseEvent; | ||
|
||
/** | ||
* Firewall collecting called listeners. | ||
* | ||
* @author Robin Chalas <robin.chalas@gmail.com> | ||
*/ | ||
final class TraceableFirewallListener extends FirewallListener | ||
{ | ||
private $wrappedListeners; | ||
|
||
public function getWrappedListeners() | ||
{ | ||
return $this->wrappedListeners; | ||
} | ||
|
||
protected function handleRequest(GetResponseEvent $event, $listeners) | ||
{ | ||
foreach ($listeners as $listener) { | ||
$wrappedListener = new WrappedListener($listener); | ||
$wrappedListener->handle($event); | ||
$this->wrappedListeners[] = $wrappedListener->getInfo(); | ||
|
||
if ($event->hasResponse()) { | ||
break; | ||
} | ||
} | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bundle\SecurityBundle\Debug; | ||
|
||
use Symfony\Component\HttpKernel\Event\GetResponseEvent; | ||
use Symfony\Component\Security\Http\Firewall\ListenerInterface; | ||
use Symfony\Component\VarDumper\Caster\ClassStub; | ||
|
||
/** | ||
* Wraps a security listener for calls record. | ||
* | ||
* @author Robin Chalas <robin.chalas@gmail.com> | ||
*/ | ||
final class WrappedListener implements ListenerInterface | ||
{ | ||
private $response; | ||
private $listener; | ||
private $time; | ||
private $stub; | ||
private static $hasVarDumper; | ||
|
||
public function __construct(ListenerInterface $listener) | ||
{ | ||
$this->listener = $listener; | ||
|
||
if (null === self::$hasVarDumper) { | ||
self::$hasVarDumper = class_exists(ClassStub::class); | ||
} | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function handle(GetResponseEvent $event) | ||
{ | ||
$startTime = microtime(true); | ||
$this->listener->handle($event); | ||
$this->time = microtime(true) - $startTime; | ||
$this->response = $event->getResponse(); | ||
} | ||
|
||
/** | ||
* Proxies all method calls to the original listener. | ||
*/ | ||
public function __call($method, $arguments) | ||
{ | ||
return call_user_func_array(array($this->listener, $method), $arguments); | ||
} | ||
|
||
public function getWrappedListener() | ||
{ | ||
return $this->listener; | ||
} | ||
|
||
public function getInfo() | ||
{ | ||
if (null === $this->stub) { | ||
$this->stub = self::$hasVarDumper ? new ClassStub(get_class($this->listener)) : get_class($this->listener); | ||
} | ||
|
||
return array( | ||
'response' => $this->response, | ||
'time' => $this->time, | ||
'stub' => $this->stub, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.