tex/src/Document.php

37 lines
738 B
PHP
Raw Normal View History

2022-10-26 16:13:19 +02:00
<?php
namespace Zoomyboy\Tex;
abstract class Document
{
2022-10-28 11:55:09 +02:00
abstract public function basename(): string;
2022-10-27 02:26:32 +02:00
abstract public function view(): string;
2022-10-27 16:54:24 +02:00
abstract public function template(): ?Template;
2022-10-27 02:26:32 +02:00
2022-10-27 16:54:24 +02:00
abstract public function getEngine(): Engine;
2022-10-27 02:26:32 +02:00
2022-10-27 16:54:24 +02:00
public function renderBody(): string
2022-10-26 16:13:19 +02:00
{
2022-10-27 16:54:24 +02:00
return view()
->make($this->view(), get_object_vars($this))
->render();
2022-10-26 16:13:19 +02:00
}
2022-10-28 11:55:09 +02:00
public function hasContent(string $content): bool
{
return str_contains($this->renderBody(), $content);
}
public function filename(): string
{
return $this->basename().'.tex';
}
public function compiledFilename(): string
{
return $this->basename().'.pdf';
}
2022-10-26 16:13:19 +02:00
}