0 follower

Final Class Yiisoft\Yii\Debug\Collector\EventCollector

InheritanceYiisoft\Yii\Debug\Collector\EventCollector
ImplementsYiisoft\Yii\Debug\Collector\SummaryCollectorInterface
Uses TraitsYiisoft\Yii\Debug\Collector\CollectorTrait

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( Yiisoft\Yii\Debug\Collector\TimelineCollector $timelineCollector )
$timelineCollector Yiisoft\Yii\Debug\Collector\TimelineCollector

                public function __construct(
    private readonly TimelineCollector $timelineCollector
) {
}

            
collect() public method

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);
}

            
getCollected() public method

public array getCollected ( )

                public function getCollected(): array
{
    if (!$this->isActive()) {
        return [];
    }
    return $this->events;
}

            
getName() public method
public string getName ( )

                public function getName(): string
{
    return self::class;
}

            
getSummary() public method

public array getSummary ( )

                public function getSummary(): array
{
    if (!$this->isActive()) {
        return [];
    }
    return [
        'total' => count($this->events),
    ];
}

            
shutdown() public method
public void shutdown ( )

                public function shutdown(): void
{
    $this->reset();
    $this->isActive = false;
}

            
startup() public method
public void startup ( )

                public function startup(): void
{
    $this->isActive = true;
}