document = $document; $this->templateRenderer = $templateRenderer; } public function render(): string { return (new BaseDocumentRender($this->document))->render(); } public function renderDocument(): string { return $this->templateRenderer->render('document.tex.twig', [ 'isMain' => $this->isMain(), 'document' => $this->document, 'body' => $this->render(), ]); } private function isMain(): bool { return count($this->document->getNodes(static function ($node): bool { return $node instanceof MainNode; })) !== 0; } }