addModification(new FormatModification()); } /** * @var Id */ protected Id $id; /** * @param Id $id * @return Printer */ public function setId(Id $id): static { $this->id = $id; return $this; } /** * @return string */ protected function printLog(): string { return '
' . parent::printLog() . '
'; } /** * @param EntryInterface|null $entry * @return string * @throws \Exception */ protected function printEntry(?EntryInterface $entry = null): string { $entry = $entry ?? $this->entry; /** @var Entry $entry */ $return = ''; $first = true; foreach ($entry as $line) { $entryClass = "entry-no-error"; if ($entry->getLevel()->asInt() <= Level::ERROR->asInt()) { $entryClass = "entry-error"; } $return .= '
'; $return .= '
' . $line->getNumber() . '
'; $return .= '
'; $lineString = $this->printLine($line); if ($entry->getPrefix() !== null) { $prefix = htmlentities($entry->getPrefix()); $lineString = str_replace($prefix, '' . $prefix . '', $lineString); } $return .= $lineString; $return .= '
'; $return .= '
'; $first = false; } return $return; } /** * @param LineInterface $line * @return string */ protected function printLine(LineInterface $line): string { return $this->runModifications(htmlentities($line->getText())) . PHP_EOL; } }