public function hasRecords(string|int|null $level = null) : bool { if ($level === null) { return \count($this->records) !== 0; } return isset($this->recordsByLevel[$level]); }