*/ private array $records = []; public function handle(LogRecord $record): void { $this->records[] = $record; } /** * @return array */ public function getRecords(): array { return $this->records; } public function clear(): void { $this->records = []; } public function hasRecordThatContains(string $needle): bool { foreach ($this->records as $record) { if (str_contains($record->message, $needle)) { return true; } } return false; } public function getRecordCount(): int { return count($this->records); } }