upgraded dependencies
This commit is contained in:
@@ -15,20 +15,13 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* AjaxDataCollector.
|
||||
*
|
||||
* @author Bart van den Burg <bart@burgov.nl>
|
||||
*
|
||||
* @final since Symfony 4.4
|
||||
* @final
|
||||
*/
|
||||
class AjaxDataCollector extends DataCollector
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param \Throwable|null $exception
|
||||
*/
|
||||
public function collect(Request $request, Response $response/* , \Throwable $exception = null */)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
// all collecting is done client side
|
||||
}
|
||||
@@ -38,7 +31,7 @@ class AjaxDataCollector extends DataCollector
|
||||
// all collecting is done client side
|
||||
}
|
||||
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'ajax';
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ use Symfony\Component\VarDumper\Caster\ClassStub;
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final since Symfony 4.4
|
||||
* @final
|
||||
*/
|
||||
class ConfigDataCollector extends DataCollector implements LateDataCollectorInterface
|
||||
{
|
||||
@@ -28,21 +28,6 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
* @var KernelInterface
|
||||
*/
|
||||
private $kernel;
|
||||
private $name;
|
||||
private $version;
|
||||
|
||||
public function __construct(string $name = null, string $version = null)
|
||||
{
|
||||
if (1 <= \func_num_args()) {
|
||||
@trigger_error(sprintf('The "$name" argument in method "%s()" is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
|
||||
}
|
||||
if (2 <= \func_num_args()) {
|
||||
@trigger_error(sprintf('The "$version" argument in method "%s()" is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->name = $name;
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Kernel associated with this Request.
|
||||
@@ -54,17 +39,13 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param \Throwable|null $exception
|
||||
*/
|
||||
public function collect(Request $request, Response $response/* , \Throwable $exception = null */)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
$eom = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_MAINTENANCE);
|
||||
$eol = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_LIFE);
|
||||
|
||||
$this->data = [
|
||||
'app_name' => $this->name,
|
||||
'app_version' => $this->version,
|
||||
'token' => $response->headers->get('X-Debug-Token'),
|
||||
'symfony_version' => Kernel::VERSION,
|
||||
'symfony_minor_version' => sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION),
|
||||
@@ -110,42 +91,18 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
$this->data = $this->cloneVar($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 4.2
|
||||
*/
|
||||
public function getApplicationName()
|
||||
{
|
||||
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
return $this->data['app_name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 4.2
|
||||
*/
|
||||
public function getApplicationVersion()
|
||||
{
|
||||
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
return $this->data['app_version'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the token.
|
||||
*
|
||||
* @return string|null The token
|
||||
*/
|
||||
public function getToken()
|
||||
public function getToken(): ?string
|
||||
{
|
||||
return $this->data['token'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Symfony version.
|
||||
*
|
||||
* @return string The Symfony version
|
||||
*/
|
||||
public function getSymfonyVersion()
|
||||
public function getSymfonyVersion(): string
|
||||
{
|
||||
return $this->data['symfony_version'];
|
||||
}
|
||||
@@ -155,7 +112,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
*
|
||||
* @return string One of: unknown, dev, stable, eom, eol
|
||||
*/
|
||||
public function getSymfonyState()
|
||||
public function getSymfonyState(): string
|
||||
{
|
||||
return $this->data['symfony_state'];
|
||||
}
|
||||
@@ -163,10 +120,8 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
/**
|
||||
* Returns the minor Symfony version used (without patch numbers of extra
|
||||
* suffix like "RC", "beta", etc.).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSymfonyMinorVersion()
|
||||
public function getSymfonyMinorVersion(): string
|
||||
{
|
||||
return $this->data['symfony_minor_version'];
|
||||
}
|
||||
@@ -182,10 +137,8 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
/**
|
||||
* Returns the human readable date when this Symfony version ends its
|
||||
* maintenance period.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSymfonyEom()
|
||||
public function getSymfonyEom(): string
|
||||
{
|
||||
return $this->data['symfony_eom'];
|
||||
}
|
||||
@@ -193,30 +146,24 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
/**
|
||||
* Returns the human readable date when this Symfony version reaches its
|
||||
* "end of life" and won't receive bugs or security fixes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSymfonyEol()
|
||||
public function getSymfonyEol(): string
|
||||
{
|
||||
return $this->data['symfony_eol'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the PHP version.
|
||||
*
|
||||
* @return string The PHP version
|
||||
*/
|
||||
public function getPhpVersion()
|
||||
public function getPhpVersion(): string
|
||||
{
|
||||
return $this->data['php_version'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the PHP version extra part.
|
||||
*
|
||||
* @return string|null The extra part
|
||||
*/
|
||||
public function getPhpVersionExtra()
|
||||
public function getPhpVersionExtra(): ?string
|
||||
{
|
||||
return $this->data['php_version_extra'] ?? null;
|
||||
}
|
||||
@@ -224,47 +171,25 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
/**
|
||||
* @return int The PHP architecture as number of bits (e.g. 32 or 64)
|
||||
*/
|
||||
public function getPhpArchitecture()
|
||||
public function getPhpArchitecture(): int
|
||||
{
|
||||
return $this->data['php_architecture'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPhpIntlLocale()
|
||||
public function getPhpIntlLocale(): string
|
||||
{
|
||||
return $this->data['php_intl_locale'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPhpTimezone()
|
||||
public function getPhpTimezone(): string
|
||||
{
|
||||
return $this->data['php_timezone'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the application name.
|
||||
*
|
||||
* @return string The application name
|
||||
*
|
||||
* @deprecated since Symfony 4.2
|
||||
*/
|
||||
public function getAppName()
|
||||
{
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
return 'n/a';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the environment.
|
||||
*
|
||||
* @return string The environment
|
||||
*/
|
||||
public function getEnv()
|
||||
public function getEnv(): string
|
||||
{
|
||||
return $this->data['env'];
|
||||
}
|
||||
@@ -272,7 +197,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
/**
|
||||
* Returns true if the debug is enabled.
|
||||
*
|
||||
* @return bool true if debug is enabled, false otherwise
|
||||
* @return bool|string true if debug is enabled, false otherwise or a string if no kernel was set
|
||||
*/
|
||||
public function isDebug()
|
||||
{
|
||||
@@ -281,30 +206,24 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
|
||||
/**
|
||||
* Returns true if the XDebug is enabled.
|
||||
*
|
||||
* @return bool true if XDebug is enabled, false otherwise
|
||||
*/
|
||||
public function hasXDebug()
|
||||
public function hasXDebug(): bool
|
||||
{
|
||||
return $this->data['xdebug_enabled'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if APCu is enabled.
|
||||
*
|
||||
* @return bool true if APCu is enabled, false otherwise
|
||||
*/
|
||||
public function hasApcu()
|
||||
public function hasApcu(): bool
|
||||
{
|
||||
return $this->data['apcu_enabled'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if Zend OPcache is enabled.
|
||||
*
|
||||
* @return bool true if Zend OPcache is enabled, false otherwise
|
||||
*/
|
||||
public function hasZendOpcache()
|
||||
public function hasZendOpcache(): bool
|
||||
{
|
||||
return $this->data['zend_opcache_enabled'];
|
||||
}
|
||||
@@ -316,10 +235,8 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
|
||||
/**
|
||||
* Gets the PHP SAPI name.
|
||||
*
|
||||
* @return string The environment
|
||||
*/
|
||||
public function getSapiName()
|
||||
public function getSapiName(): string
|
||||
{
|
||||
return $this->data['sapi_name'];
|
||||
}
|
||||
@@ -327,7 +244,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'config';
|
||||
}
|
||||
|
@@ -38,29 +38,6 @@ abstract class DataCollector implements DataCollectorInterface
|
||||
*/
|
||||
private $cloner;
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 4.3, store all the serialized state in the data property instead
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
@trigger_error(sprintf('The "%s" method is deprecated since Symfony 4.3, store all the serialized state in the data property instead.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
$trace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
|
||||
$isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
|
||||
|
||||
return $isCalledFromOverridingMethod ? $this->data : serialize($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 4.3, store all the serialized state in the data property instead
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
@trigger_error(sprintf('The "%s" method is deprecated since Symfony 4.3, store all the serialized state in the data property instead.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
$this->data = \is_array($data) ? $data : unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the variable into a serializable Data instance.
|
||||
*
|
||||
@@ -112,23 +89,24 @@ abstract class DataCollector implements DataCollectorInterface
|
||||
*/
|
||||
public function __sleep()
|
||||
{
|
||||
if (__CLASS__ !== $c = (new \ReflectionMethod($this, 'serialize'))->getDeclaringClass()->name) {
|
||||
@trigger_error(sprintf('Implementing the "%s::serialize()" method is deprecated since Symfony 4.3, store all the serialized state in the "data" property instead.', $c), \E_USER_DEPRECATED);
|
||||
$this->data = $this->serialize();
|
||||
}
|
||||
|
||||
return ['data'];
|
||||
}
|
||||
|
||||
public function __wakeup()
|
||||
{
|
||||
if (__CLASS__ !== $c = (new \ReflectionMethod($this, 'unserialize'))->getDeclaringClass()->name) {
|
||||
if (\is_object($this->data)) {
|
||||
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
|
||||
}
|
||||
}
|
||||
|
||||
@trigger_error(sprintf('Implementing the "%s::unserialize()" method is deprecated since Symfony 4.3, store all the serialized state in the "data" property instead.', $c), \E_USER_DEPRECATED);
|
||||
$this->unserialize($this->data);
|
||||
}
|
||||
/**
|
||||
* @internal to prevent implementing \Serializable
|
||||
*/
|
||||
final protected function serialize()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal to prevent implementing \Serializable
|
||||
*/
|
||||
final protected function unserialize($data)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -24,15 +24,13 @@ interface DataCollectorInterface extends ResetInterface
|
||||
{
|
||||
/**
|
||||
* Collects data for the given Request and Response.
|
||||
*
|
||||
* @param \Throwable|null $exception
|
||||
*/
|
||||
public function collect(Request $request, Response $response/* , \Throwable $exception = null */);
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null);
|
||||
|
||||
/**
|
||||
* Returns the name of the collector.
|
||||
*
|
||||
* @return string The collector name
|
||||
* @return string
|
||||
*/
|
||||
public function getName();
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ use Symfony\Component\VarDumper\Server\Connection;
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @final since Symfony 4.3
|
||||
* @final
|
||||
*/
|
||||
class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
{
|
||||
@@ -101,19 +101,14 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param \Throwable|null $exception
|
||||
*/
|
||||
public function collect(Request $request, Response $response/* , \Throwable $exception = null */)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
if (!$this->dataCount) {
|
||||
$this->data = [];
|
||||
}
|
||||
|
||||
// Sub-requests and programmatic calls stay in the collected profile.
|
||||
if ($this->dumper || ($this->requestStack && $this->requestStack->getMasterRequest() !== $request) || $request->isXmlHttpRequest() || $request->headers->has('Origin')) {
|
||||
if ($this->dumper || ($this->requestStack && $this->requestStack->getMainRequest() !== $request) || $request->isXmlHttpRequest() || $request->headers->has('Origin')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -193,12 +188,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
self::__construct($this->stopwatch, \is_string($fileLinkFormat) || $fileLinkFormat instanceof FileLinkFormatter ? $fileLinkFormat : null, \is_string($charset) ? $charset : null);
|
||||
}
|
||||
|
||||
public function getDumpsCount()
|
||||
public function getDumpsCount(): int
|
||||
{
|
||||
return $this->dataCount;
|
||||
}
|
||||
|
||||
public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1)
|
||||
public function getDumps(string $format, int $maxDepthLimit = -1, int $maxItemsPerDepth = -1): array
|
||||
{
|
||||
$data = fopen('php://memory', 'r+');
|
||||
|
||||
@@ -225,7 +220,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
return $dumps;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'dump';
|
||||
}
|
||||
|
@@ -12,19 +12,17 @@
|
||||
namespace Symfony\Component\HttpKernel\DataCollector;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\VarDumper\Cloner\Data;
|
||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Contracts\Service\ResetInterface;
|
||||
|
||||
/**
|
||||
* EventDataCollector.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final since Symfony 4.4
|
||||
* @final
|
||||
*/
|
||||
class EventDataCollector extends DataCollector implements LateDataCollectorInterface
|
||||
{
|
||||
@@ -40,12 +38,10 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param \Throwable|null $exception
|
||||
*/
|
||||
public function collect(Request $request, Response $response/* , \Throwable $exception = null */)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
$this->currentRequest = $this->requestStack && $this->requestStack->getMasterRequest() !== $request ? $request : null;
|
||||
$this->currentRequest = $this->requestStack && $this->requestStack->getMainRequest() !== $request ? $request : null;
|
||||
$this->data = [
|
||||
'called_listeners' => [],
|
||||
'not_called_listeners' => [],
|
||||
@@ -64,12 +60,9 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
|
||||
public function lateCollect()
|
||||
{
|
||||
if ($this->dispatcher instanceof TraceableEventDispatcherInterface) {
|
||||
if ($this->dispatcher instanceof TraceableEventDispatcher) {
|
||||
$this->setCalledListeners($this->dispatcher->getCalledListeners($this->currentRequest));
|
||||
$this->setNotCalledListeners($this->dispatcher->getNotCalledListeners($this->currentRequest));
|
||||
}
|
||||
|
||||
if ($this->dispatcher instanceof TraceableEventDispatcher) {
|
||||
$this->setOrphanedEvents($this->dispatcher->getOrphanedEvents($this->currentRequest));
|
||||
}
|
||||
|
||||
@@ -77,8 +70,6 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the called listeners.
|
||||
*
|
||||
* @param array $listeners An array of called listeners
|
||||
*
|
||||
* @see TraceableEventDispatcher
|
||||
@@ -89,11 +80,9 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the called listeners.
|
||||
*
|
||||
* @return array An array of called listeners
|
||||
*
|
||||
* @see TraceableEventDispatcher
|
||||
*
|
||||
* @return array|Data
|
||||
*/
|
||||
public function getCalledListeners()
|
||||
{
|
||||
@@ -101,8 +90,6 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the not called listeners.
|
||||
*
|
||||
* @see TraceableEventDispatcher
|
||||
*/
|
||||
public function setNotCalledListeners(array $listeners)
|
||||
@@ -111,11 +98,9 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the not called listeners.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @see TraceableEventDispatcher
|
||||
*
|
||||
* @return array|Data
|
||||
*/
|
||||
public function getNotCalledListeners()
|
||||
{
|
||||
@@ -123,8 +108,6 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the orphaned events.
|
||||
*
|
||||
* @param array $events An array of orphaned events
|
||||
*
|
||||
* @see TraceableEventDispatcher
|
||||
@@ -135,11 +118,9 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the orphaned events.
|
||||
*
|
||||
* @return array An array of orphaned events
|
||||
*
|
||||
* @see TraceableEventDispatcher
|
||||
*
|
||||
* @return array|Data
|
||||
*/
|
||||
public function getOrphanedEvents()
|
||||
{
|
||||
@@ -149,7 +130,7 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'events';
|
||||
}
|
||||
|
@@ -16,23 +16,17 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* ExceptionDataCollector.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final since Symfony 4.4
|
||||
* @final
|
||||
*/
|
||||
class ExceptionDataCollector extends DataCollector
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param \Throwable|null $exception
|
||||
*/
|
||||
public function collect(Request $request, Response $response/* , \Throwable $exception = null */)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
$exception = 2 < \func_num_args() ? func_get_arg(2) : null;
|
||||
|
||||
if (null !== $exception) {
|
||||
$this->data = [
|
||||
'exception' => FlattenException::createFromThrowable($exception),
|
||||
@@ -48,19 +42,12 @@ class ExceptionDataCollector extends DataCollector
|
||||
$this->data = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the exception is not null.
|
||||
*
|
||||
* @return bool true if the exception is not null, false otherwise
|
||||
*/
|
||||
public function hasException()
|
||||
public function hasException(): bool
|
||||
{
|
||||
return isset($this->data['exception']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the exception.
|
||||
*
|
||||
* @return \Exception|FlattenException
|
||||
*/
|
||||
public function getException()
|
||||
@@ -68,42 +55,22 @@ class ExceptionDataCollector extends DataCollector
|
||||
return $this->data['exception'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the exception message.
|
||||
*
|
||||
* @return string The exception message
|
||||
*/
|
||||
public function getMessage()
|
||||
public function getMessage(): string
|
||||
{
|
||||
return $this->data['exception']->getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the exception code.
|
||||
*
|
||||
* @return int The exception code
|
||||
*/
|
||||
public function getCode()
|
||||
public function getCode(): int
|
||||
{
|
||||
return $this->data['exception']->getCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status code.
|
||||
*
|
||||
* @return int The status code
|
||||
*/
|
||||
public function getStatusCode()
|
||||
public function getStatusCode(): int
|
||||
{
|
||||
return $this->data['exception']->getStatusCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the exception trace.
|
||||
*
|
||||
* @return array The exception trace
|
||||
*/
|
||||
public function getTrace()
|
||||
public function getTrace(): array
|
||||
{
|
||||
return $this->data['exception']->getTrace();
|
||||
}
|
||||
@@ -111,7 +78,7 @@ class ExceptionDataCollector extends DataCollector
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'exception';
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final since Symfony 4.4
|
||||
* @final
|
||||
*/
|
||||
class LoggerDataCollector extends DataCollector implements LateDataCollectorInterface
|
||||
{
|
||||
@@ -28,8 +28,9 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
private $containerPathPrefix;
|
||||
private $currentRequest;
|
||||
private $requestStack;
|
||||
private $processedLogs;
|
||||
|
||||
public function __construct($logger = null, string $containerPathPrefix = null, RequestStack $requestStack = null)
|
||||
public function __construct(object $logger = null, string $containerPathPrefix = null, RequestStack $requestStack = null)
|
||||
{
|
||||
if (null !== $logger && $logger instanceof DebugLoggerInterface) {
|
||||
$this->logger = $logger;
|
||||
@@ -41,12 +42,10 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param \Throwable|null $exception
|
||||
*/
|
||||
public function collect(Request $request, Response $response/* , \Throwable $exception = null */)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
$this->currentRequest = $this->requestStack && $this->requestStack->getMasterRequest() !== $request ? $request : null;
|
||||
$this->currentRequest = $this->requestStack && $this->requestStack->getMainRequest() !== $request ? $request : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,6 +81,82 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
return $this->data['logs'] ?? [];
|
||||
}
|
||||
|
||||
public function getProcessedLogs()
|
||||
{
|
||||
if (null !== $this->processedLogs) {
|
||||
return $this->processedLogs;
|
||||
}
|
||||
|
||||
$rawLogs = $this->getLogs();
|
||||
if ([] === $rawLogs) {
|
||||
return $this->processedLogs = $rawLogs;
|
||||
}
|
||||
|
||||
$logs = [];
|
||||
foreach ($this->getLogs()->getValue() as $rawLog) {
|
||||
$rawLogData = $rawLog->getValue();
|
||||
|
||||
if ($rawLogData['priority']->getValue() > 300) {
|
||||
$logType = 'error';
|
||||
} elseif (isset($rawLogData['scream']) && false === $rawLogData['scream']->getValue()) {
|
||||
$logType = 'deprecation';
|
||||
} elseif (isset($rawLogData['scream']) && true === $rawLogData['scream']->getValue()) {
|
||||
$logType = 'silenced';
|
||||
} else {
|
||||
$logType = 'regular';
|
||||
}
|
||||
|
||||
$logs[] = [
|
||||
'type' => $logType,
|
||||
'errorCount' => $rawLog['errorCount'] ?? 1,
|
||||
'timestamp' => $rawLogData['timestamp_rfc3339']->getValue(),
|
||||
'priority' => $rawLogData['priority']->getValue(),
|
||||
'priorityName' => $rawLogData['priorityName']->getValue(),
|
||||
'channel' => $rawLogData['channel']->getValue(),
|
||||
'message' => $rawLogData['message'],
|
||||
'context' => $rawLogData['context'],
|
||||
];
|
||||
}
|
||||
|
||||
// sort logs from oldest to newest
|
||||
usort($logs, static function ($logA, $logB) {
|
||||
return $logA['timestamp'] <=> $logB['timestamp'];
|
||||
});
|
||||
|
||||
return $this->processedLogs = $logs;
|
||||
}
|
||||
|
||||
public function getFilters()
|
||||
{
|
||||
$filters = [
|
||||
'channel' => [],
|
||||
'priority' => [
|
||||
'Debug' => 100,
|
||||
'Info' => 200,
|
||||
'Notice' => 250,
|
||||
'Warning' => 300,
|
||||
'Error' => 400,
|
||||
'Critical' => 500,
|
||||
'Alert' => 550,
|
||||
'Emergency' => 600,
|
||||
],
|
||||
];
|
||||
|
||||
$allChannels = [];
|
||||
foreach ($this->getProcessedLogs() as $log) {
|
||||
if ('' === trim($log['channel'] ?? '')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$allChannels[] = $log['channel'];
|
||||
}
|
||||
$channels = array_unique($allChannels);
|
||||
sort($channels);
|
||||
$filters['channel'] = $channels;
|
||||
|
||||
return $filters;
|
||||
}
|
||||
|
||||
public function getPriorities()
|
||||
{
|
||||
return $this->data['priorities'] ?? [];
|
||||
@@ -115,14 +190,14 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'logger';
|
||||
}
|
||||
|
||||
private function getContainerDeprecationLogs(): array
|
||||
{
|
||||
if (null === $this->containerPathPrefix || !file_exists($file = $this->containerPathPrefix.'Deprecations.log')) {
|
||||
if (null === $this->containerPathPrefix || !is_file($file = $this->containerPathPrefix.'Deprecations.log')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -135,6 +210,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
foreach (unserialize($logContent) as $log) {
|
||||
$log['context'] = ['exception' => new SilencedErrorContext($log['type'], $log['file'], $log['line'], $log['trace'], $log['count'])];
|
||||
$log['timestamp'] = $bootTime;
|
||||
$log['timestamp_rfc3339'] = (new \DateTimeImmutable())->setTimestamp($bootTime)->format(\DateTimeInterface::RFC3339_EXTENDED);
|
||||
$log['priority'] = 100;
|
||||
$log['priorityName'] = 'DEBUG';
|
||||
$log['channel'] = null;
|
||||
@@ -148,7 +224,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
|
||||
private function getContainerCompilerLogs(string $compilerLogsFilepath = null): array
|
||||
{
|
||||
if (!file_exists($compilerLogsFilepath)) {
|
||||
if (!is_file($compilerLogsFilepath)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@@ -15,11 +15,9 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* MemoryDataCollector.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final since Symfony 4.4
|
||||
* @final
|
||||
*/
|
||||
class MemoryDataCollector extends DataCollector implements LateDataCollectorInterface
|
||||
{
|
||||
@@ -30,10 +28,8 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param \Throwable|null $exception
|
||||
*/
|
||||
public function collect(Request $request, Response $response/* , \Throwable $exception = null */)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
$this->updateMemoryUsage();
|
||||
}
|
||||
@@ -57,29 +53,19 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
$this->updateMemoryUsage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the memory.
|
||||
*
|
||||
* @return int The memory
|
||||
*/
|
||||
public function getMemory()
|
||||
public function getMemory(): int
|
||||
{
|
||||
return $this->data['memory'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the PHP memory limit.
|
||||
*
|
||||
* @return int The memory limit
|
||||
* @return int|float
|
||||
*/
|
||||
public function getMemoryLimit()
|
||||
{
|
||||
return $this->data['memory_limit'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the memory usage data.
|
||||
*/
|
||||
public function updateMemoryUsage()
|
||||
{
|
||||
$this->data['memory'] = memory_get_peak_usage(true);
|
||||
@@ -88,7 +74,7 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'memory';
|
||||
}
|
||||
|
@@ -15,31 +15,39 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\HttpKernel\Event\ControllerEvent;
|
||||
use Symfony\Component\HttpKernel\Event\ResponseEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\VarDumper\Cloner\Data;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final since Symfony 4.4
|
||||
* @final
|
||||
*/
|
||||
class RequestDataCollector extends DataCollector implements EventSubscriberInterface, LateDataCollectorInterface
|
||||
{
|
||||
protected $controllers;
|
||||
/**
|
||||
* @var \SplObjectStorage<Request, callable>
|
||||
*/
|
||||
private $controllers;
|
||||
private $sessionUsages = [];
|
||||
private $requestStack;
|
||||
|
||||
public function __construct()
|
||||
public function __construct(RequestStack $requestStack = null)
|
||||
{
|
||||
$this->controllers = new \SplObjectStorage();
|
||||
$this->requestStack = $requestStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param \Throwable|null $exception
|
||||
*/
|
||||
public function collect(Request $request, Response $response/* , \Throwable $exception = null */)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
// attributes are serialized and as they can be anything, they need to be converted to strings.
|
||||
$attributes = [];
|
||||
@@ -86,7 +94,6 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
$this->data = [
|
||||
'method' => $request->getMethod(),
|
||||
'format' => $request->getRequestFormat(),
|
||||
'content' => $content,
|
||||
'content_type' => $response->headers->get('Content-Type', 'text/html'),
|
||||
'status_text' => Response::$statusTexts[$statusCode] ?? '',
|
||||
'status_code' => $statusCode,
|
||||
@@ -102,6 +109,8 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
'response_cookies' => $responseCookies,
|
||||
'session_metadata' => $sessionMetadata,
|
||||
'session_attributes' => $sessionAttributes,
|
||||
'session_usages' => array_values($this->sessionUsages),
|
||||
'stateless_check' => $this->requestStack && ($mainRequest = $this->requestStack->getMainRequest()) && $mainRequest->attributes->get('_stateless', false),
|
||||
'flashes' => $flashes,
|
||||
'path_info' => $request->getPathInfo(),
|
||||
'controller' => 'n/a',
|
||||
@@ -118,9 +127,13 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
}
|
||||
|
||||
if (isset($this->data['request_request']['_password'])) {
|
||||
$encodedPassword = rawurlencode($this->data['request_request']['_password']);
|
||||
$content = str_replace('_password='.$encodedPassword, '_password=******', $content);
|
||||
$this->data['request_request']['_password'] = '******';
|
||||
}
|
||||
|
||||
$this->data['content'] = $content;
|
||||
|
||||
foreach ($this->data as $key => $value) {
|
||||
if (!\is_array($value)) {
|
||||
continue;
|
||||
@@ -172,6 +185,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
{
|
||||
$this->data = [];
|
||||
$this->controllers = new \SplObjectStorage();
|
||||
$this->sessionUsages = [];
|
||||
}
|
||||
|
||||
public function getMethod()
|
||||
@@ -204,12 +218,12 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
return new ParameterBag($this->data['request_headers']->getValue());
|
||||
}
|
||||
|
||||
public function getRequestServer($raw = false)
|
||||
public function getRequestServer(bool $raw = false)
|
||||
{
|
||||
return new ParameterBag($this->data['request_server']->getValue($raw));
|
||||
}
|
||||
|
||||
public function getRequestCookies($raw = false)
|
||||
public function getRequestCookies(bool $raw = false)
|
||||
{
|
||||
return new ParameterBag($this->data['request_cookies']->getValue($raw));
|
||||
}
|
||||
@@ -239,6 +253,16 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
return $this->data['session_attributes']->getValue();
|
||||
}
|
||||
|
||||
public function getStatelessCheck()
|
||||
{
|
||||
return $this->data['stateless_check'];
|
||||
}
|
||||
|
||||
public function getSessionUsages()
|
||||
{
|
||||
return $this->data['session_usages'];
|
||||
}
|
||||
|
||||
public function getFlashes()
|
||||
{
|
||||
return $this->data['flashes']->getValue();
|
||||
@@ -295,10 +319,8 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
* Gets the route name.
|
||||
*
|
||||
* The _route request attributes is automatically set by the Router Matcher.
|
||||
*
|
||||
* @return string The route
|
||||
*/
|
||||
public function getRoute()
|
||||
public function getRoute(): string
|
||||
{
|
||||
return $this->data['route'];
|
||||
}
|
||||
@@ -312,10 +334,8 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
* Gets the route parameters.
|
||||
*
|
||||
* The _route_params request attributes is automatically set by the RouterListener.
|
||||
*
|
||||
* @return array The parameters
|
||||
*/
|
||||
public function getRouteParams()
|
||||
public function getRouteParams(): array
|
||||
{
|
||||
return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params']->getValue() : [];
|
||||
}
|
||||
@@ -323,8 +343,8 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
/**
|
||||
* Gets the parsed controller.
|
||||
*
|
||||
* @return array|string The controller as a string or array of data
|
||||
* with keys 'class', 'method', 'file' and 'line'
|
||||
* @return array|string|Data The controller as a string or array of data
|
||||
* with keys 'class', 'method', 'file' and 'line'
|
||||
*/
|
||||
public function getController()
|
||||
{
|
||||
@@ -334,8 +354,8 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
/**
|
||||
* Gets the previous request attributes.
|
||||
*
|
||||
* @return array|bool A legacy array of data from the previous redirection response
|
||||
* or false otherwise
|
||||
* @return array|Data|false A legacy array of data from the previous redirection response
|
||||
* or false otherwise
|
||||
*/
|
||||
public function getRedirect()
|
||||
{
|
||||
@@ -347,20 +367,14 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
return $this->data['forward_token'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @final since Symfony 4.3
|
||||
*/
|
||||
public function onKernelController(FilterControllerEvent $event)
|
||||
public function onKernelController(ControllerEvent $event)
|
||||
{
|
||||
$this->controllers[$event->getRequest()] = $event->getController();
|
||||
}
|
||||
|
||||
/**
|
||||
* @final since Symfony 4.3
|
||||
*/
|
||||
public function onKernelResponse(FilterResponseEvent $event)
|
||||
public function onKernelResponse(ResponseEvent $event)
|
||||
{
|
||||
if (!$event->isMasterRequest()) {
|
||||
if (!$event->isMainRequest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -369,7 +383,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::CONTROLLER => 'onKernelController',
|
||||
@@ -380,19 +394,48 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'request';
|
||||
}
|
||||
|
||||
public function collectSessionUsage(): void
|
||||
{
|
||||
$trace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
|
||||
$traceEndIndex = \count($trace) - 1;
|
||||
for ($i = $traceEndIndex; $i > 0; --$i) {
|
||||
if (null !== ($class = $trace[$i]['class'] ?? null) && (is_subclass_of($class, SessionInterface::class) || is_subclass_of($class, SessionBagInterface::class))) {
|
||||
$traceEndIndex = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((\count($trace) - 1) === $traceEndIndex) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove part of the backtrace that belongs to session only
|
||||
array_splice($trace, 0, $traceEndIndex);
|
||||
|
||||
// Merge identical backtraces generated by internal call reports
|
||||
$name = sprintf('%s:%s', $trace[1]['class'] ?? $trace[0]['file'], $trace[0]['line']);
|
||||
if (!\array_key_exists($name, $this->sessionUsages)) {
|
||||
$this->sessionUsages[$name] = [
|
||||
'name' => $name,
|
||||
'file' => $trace[0]['file'],
|
||||
'line' => $trace[0]['line'],
|
||||
'trace' => $trace,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a controller.
|
||||
*
|
||||
* @param string|object|array|null $controller The controller to parse
|
||||
*
|
||||
* @return array|string An array of controller data or a simple string
|
||||
*/
|
||||
protected function parseController($controller)
|
||||
private function parseController($controller)
|
||||
{
|
||||
if (\is_string($controller) && str_contains($controller, '::')) {
|
||||
$controller = explode('::', $controller);
|
||||
@@ -403,7 +446,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
$r = new \ReflectionMethod($controller[0], $controller[1]);
|
||||
|
||||
return [
|
||||
'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0],
|
||||
'class' => \is_object($controller[0]) ? get_debug_type($controller[0]) : $controller[0],
|
||||
'method' => $controller[1],
|
||||
'file' => $r->getFileName(),
|
||||
'line' => $r->getStartLine(),
|
||||
@@ -412,7 +455,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
if (\is_callable($controller)) {
|
||||
// using __call or __callStatic
|
||||
return [
|
||||
'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0],
|
||||
'class' => \is_object($controller[0]) ? get_debug_type($controller[0]) : $controller[0],
|
||||
'method' => $controller[1],
|
||||
'file' => 'n/a',
|
||||
'line' => 'n/a',
|
||||
@@ -436,7 +479,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
}
|
||||
$controller['method'] = $r->name;
|
||||
|
||||
if ($class = $r->getClosureScopeClass()) {
|
||||
if ($class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) {
|
||||
$controller['class'] = $class->name;
|
||||
} else {
|
||||
return $r->name;
|
||||
|
@@ -14,7 +14,7 @@ namespace Symfony\Component\HttpKernel\DataCollector;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
use Symfony\Component\HttpKernel\Event\ControllerEvent;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
@@ -22,7 +22,7 @@ use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
class RouterDataCollector extends DataCollector
|
||||
{
|
||||
/**
|
||||
* @var \SplObjectStorage
|
||||
* @var \SplObjectStorage<Request, callable>
|
||||
*/
|
||||
protected $controllers;
|
||||
|
||||
@@ -34,11 +34,9 @@ class RouterDataCollector extends DataCollector
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param \Throwable|null $exception
|
||||
*
|
||||
* @final since Symfony 4.4
|
||||
* @final
|
||||
*/
|
||||
public function collect(Request $request, Response $response/* , \Throwable $exception = null */)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
if ($response instanceof RedirectResponse) {
|
||||
$this->data['redirect'] = true;
|
||||
@@ -70,10 +68,8 @@ class RouterDataCollector extends DataCollector
|
||||
|
||||
/**
|
||||
* Remembers the controller associated to each request.
|
||||
*
|
||||
* @final since Symfony 4.3
|
||||
*/
|
||||
public function onKernelController(FilterControllerEvent $event)
|
||||
public function onKernelController(ControllerEvent $event)
|
||||
{
|
||||
$this->controllers[$event->getRequest()] = $event->getController();
|
||||
}
|
||||
@@ -87,7 +83,7 @@ class RouterDataCollector extends DataCollector
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null The target URL
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTargetUrl()
|
||||
{
|
||||
@@ -95,7 +91,7 @@ class RouterDataCollector extends DataCollector
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null The target route
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTargetRoute()
|
||||
{
|
||||
|
@@ -20,12 +20,12 @@ use Symfony\Component\Stopwatch\StopwatchEvent;
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final since Symfony 4.4
|
||||
* @final
|
||||
*/
|
||||
class TimeDataCollector extends DataCollector implements LateDataCollectorInterface
|
||||
{
|
||||
protected $kernel;
|
||||
protected $stopwatch;
|
||||
private $kernel;
|
||||
private $stopwatch;
|
||||
|
||||
public function __construct(KernelInterface $kernel = null, Stopwatch $stopwatch = null)
|
||||
{
|
||||
@@ -35,10 +35,8 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param \Throwable|null $exception
|
||||
*/
|
||||
public function collect(Request $request, Response $response/* , \Throwable $exception = null */)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
if (null !== $this->kernel) {
|
||||
$startTime = $this->kernel->getStartTime();
|
||||
@@ -78,8 +76,6 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the request events.
|
||||
*
|
||||
* @param StopwatchEvent[] $events The request events
|
||||
*/
|
||||
public function setEvents(array $events)
|
||||
@@ -92,21 +88,17 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the request events.
|
||||
*
|
||||
* @return StopwatchEvent[] The request events
|
||||
* @return StopwatchEvent[]
|
||||
*/
|
||||
public function getEvents()
|
||||
public function getEvents(): array
|
||||
{
|
||||
return $this->data['events'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the request elapsed time.
|
||||
*
|
||||
* @return float The elapsed time
|
||||
*/
|
||||
public function getDuration()
|
||||
public function getDuration(): float
|
||||
{
|
||||
if (!isset($this->data['events']['__section__'])) {
|
||||
return 0;
|
||||
@@ -121,10 +113,8 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
|
||||
* Gets the initialization time.
|
||||
*
|
||||
* This is the time spent until the beginning of the request handling.
|
||||
*
|
||||
* @return float The elapsed time
|
||||
*/
|
||||
public function getInitTime()
|
||||
public function getInitTime(): float
|
||||
{
|
||||
if (!isset($this->data['events']['__section__'])) {
|
||||
return 0;
|
||||
@@ -133,20 +123,12 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
|
||||
return $this->data['events']['__section__']->getOrigin() - $this->getStartTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the request time.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getStartTime()
|
||||
public function getStartTime(): float
|
||||
{
|
||||
return $this->data['start_time'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool whether or not the stopwatch component is installed
|
||||
*/
|
||||
public function isStopwatchInstalled()
|
||||
public function isStopwatchInstalled(): bool
|
||||
{
|
||||
return $this->data['stopwatch_installed'];
|
||||
}
|
||||
@@ -154,7 +136,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'time';
|
||||
}
|
||||
|
Reference in New Issue
Block a user