mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-26 03:58:45 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -24,19 +24,17 @@ use Symfony\Component\Stopwatch\StopwatchEvent;
|
||||
*/
|
||||
class TimeDataCollector extends DataCollector implements LateDataCollectorInterface
|
||||
{
|
||||
private $kernel;
|
||||
private $stopwatch;
|
||||
private ?KernelInterface $kernel;
|
||||
private ?Stopwatch $stopwatch;
|
||||
|
||||
public function __construct(KernelInterface $kernel = null, Stopwatch $stopwatch = null)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
$this->stopwatch = $stopwatch;
|
||||
$this->data = ['events' => [], 'stopwatch_installed' => false, 'start_time' => 0];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null): void
|
||||
{
|
||||
if (null !== $this->kernel) {
|
||||
$startTime = $this->kernel->getStartTime();
|
||||
@@ -52,22 +50,14 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function reset()
|
||||
public function reset(): void
|
||||
{
|
||||
$this->data = [];
|
||||
$this->data = ['events' => [], 'stopwatch_installed' => false, 'start_time' => 0];
|
||||
|
||||
if (null !== $this->stopwatch) {
|
||||
$this->stopwatch->reset();
|
||||
}
|
||||
$this->stopwatch?->reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function lateCollect()
|
||||
public function lateCollect(): void
|
||||
{
|
||||
if (null !== $this->stopwatch && isset($this->data['token'])) {
|
||||
$this->setEvents($this->stopwatch->getSectionEvents($this->data['token']));
|
||||
@@ -78,7 +68,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
|
||||
/**
|
||||
* @param StopwatchEvent[] $events The request events
|
||||
*/
|
||||
public function setEvents(array $events)
|
||||
public function setEvents(array $events): void
|
||||
{
|
||||
foreach ($events as $event) {
|
||||
$event->ensureStopped();
|
||||
@@ -133,9 +123,6 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
|
||||
return $this->data['stopwatch_installed'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'time';
|
||||
|
||||
Reference in New Issue
Block a user