Final Class Yiisoft\Yii\Debug\Collector\EventCollector
| Inheritance | Yiisoft\Yii\Debug\Collector\EventCollector |
|---|---|
| Implements | Yiisoft\Yii\Debug\Collector\SummaryCollectorInterface |
| Uses Traits | Yiisoft\Yii\Debug\Collector\CollectorTrait |
Public Methods
Method Details
| public mixed __construct ( Yiisoft\Yii\Debug\Collector\TimelineCollector $timelineCollector ) | ||
| $timelineCollector | Yiisoft\Yii\Debug\Collector\TimelineCollector | |
public function __construct(
private readonly TimelineCollector $timelineCollector
) {
}
| public void collect ( object $event, string $line ) | ||
| $event | object | |
| $line | string | |
public function collect(object $event, string $line): void
{
if (
!$event instanceof HttpApplicationStartup
&& !$event instanceof ConsoleApplicationStartup
&& !$this->isActive()
) {
return;
}
$this->events[] = [
'name' => $event::class,
'event' => $event,
'file' => (new ReflectionClass($event))->getFileName(),
'line' => $line,
'time' => microtime(true),
];
$this->timelineCollector->collect($this, spl_object_id($event), $event::class);
}
| public array getCollected ( ) |
public function getCollected(): array
{
if (!$this->isActive()) {
return [];
}
return $this->events;
}
| public array getSummary ( ) |
public function getSummary(): array
{
if (!$this->isActive()) {
return [];
}
return [
'total' => count($this->events),
];
}
| public void shutdown ( ) |
public function shutdown(): void
{
$this->reset();
$this->isActive = false;
}
Signup or Login in order to comment.