| Total Complexity | 8 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class MarkdownDocument implements MarkdownDocumentContract, \Stringable |
||
| 16 | { |
||
| 17 | public FrontMatter $matter; |
||
| 18 | public Markdown $markdown; |
||
| 19 | |||
| 20 | public function __construct(FrontMatter|array $matter = [], Markdown|string $body = '') |
||
| 21 | { |
||
| 22 | $this->matter = $matter instanceof FrontMatter ? $matter : new FrontMatter($matter); |
||
|
|
|||
| 23 | $this->markdown = $body instanceof Markdown ? $body : new Markdown($body); |
||
| 24 | } |
||
| 25 | |||
| 26 | public function __toString(): string |
||
| 27 | { |
||
| 28 | return $this->markdown; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function matter(string $key = null, mixed $default = null): mixed |
||
| 32 | { |
||
| 33 | return $key ? $this->matter->get($key, $default) : $this->matter; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function markdown(): Markdown |
||
| 39 | } |
||
| 40 | |||
| 41 | public static function parse(string $localFilepath): static |
||
| 44 | } |
||
| 45 | } |
||
| 46 |