Skip to content

Commit ad93e93

Browse files
committed
fix: Event collector does not collect Timeline data
1 parent 29c3117 commit ad93e93

2 files changed

Lines changed: 5 additions & 28 deletions

File tree

phpstan-baseline.neon.dist

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ parameters:
100100
count: 13
101101
path: system/Database/SQLSRV/Forge.php
102102

103-
-
104-
message: "#^Call to an undefined method CodeIgniter\\\\View\\\\RendererInterface\\:\\:getPerformanceData\\(\\)\\.$#"
105-
count: 1
106-
path: system/Debug/Toolbar/Collectors/Events.php
107-
108103
-
109104
message: "#^Property CodeIgniter\\\\Log\\\\Logger\\:\\:\\$logCache \\(array\\) on left side of \\?\\? is not nullable\\.$#"
110105
count: 1

system/Debug/Toolbar/Collectors/Events.php

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@
1111

1212
namespace CodeIgniter\Debug\Toolbar\Collectors;
1313

14-
use CodeIgniter\View\RendererInterface;
15-
use Config\Services;
16-
1714
/**
18-
* Views collector
15+
* Events collector
1916
*/
2017
class Events extends BaseCollector
2118
{
@@ -25,7 +22,7 @@ class Events extends BaseCollector
2522
*
2623
* @var bool
2724
*/
28-
protected $hasTimeline = false;
25+
protected $hasTimeline = true;
2926

3027
/**
3128
* Whether this collector needs to display
@@ -51,21 +48,6 @@ class Events extends BaseCollector
5148
*/
5249
protected $title = 'Events';
5350

54-
/**
55-
* Instance of the Renderer service
56-
*
57-
* @var RendererInterface
58-
*/
59-
protected $viewer;
60-
61-
/**
62-
* Constructor.
63-
*/
64-
public function __construct()
65-
{
66-
$this->viewer = Services::renderer();
67-
}
68-
6951
/**
7052
* Child classes should implement this to return the timeline data
7153
* formatted for correct usage.
@@ -74,12 +56,12 @@ protected function formatTimelineData(): array
7456
{
7557
$data = [];
7658

77-
$rows = $this->viewer->getPerformanceData();
59+
$rows = \CodeIgniter\Events\Events::getPerformanceLogs();
7860

7961
foreach ($rows as $info) {
8062
$data[] = [
81-
'name' => 'View: ' . $info['view'],
82-
'component' => 'Views',
63+
'name' => 'Event: ' . $info['event'],
64+
'component' => 'Events',
8365
'start' => $info['start'],
8466
'duration' => $info['end'] - $info['start'],
8567
];

0 commit comments

Comments
 (0)