Total Complexity | 9 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 7 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | class MarkdownDocument implements MarkdownDocumentContract |
||
17 | { |
||
18 | public FrontMatter $matter; |
||
19 | public Markdown $markdown; |
||
20 | |||
21 | /** @deprecated */ |
||
22 | public string $body; |
||
23 | |||
24 | public function __construct(FrontMatter|array $matter = [], Markdown|string $body = '') |
||
25 | { |
||
26 | $this->matter = $matter instanceof FrontMatter ? $matter : new FrontMatter($matter); |
||
|
|||
27 | $this->markdown = $body instanceof Markdown ? $body : new Markdown($body); |
||
28 | |||
29 | $this->body = $this->markdown->body; |
||
30 | } |
||
31 | |||
32 | public function __toString(): string |
||
33 | { |
||
34 | return $this->markdown; |
||
35 | } |
||
36 | |||
37 | public function matter(string $key = null, mixed $default = null): mixed |
||
40 | } |
||
41 | |||
42 | public function markdown(): Markdown |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @deprecated v0.56.0 - Use static::parse() instead |
||
49 | */ |
||
50 | public static function parseFile(string $localFilepath): static |
||
53 | } |
||
54 | |||
55 | public static function parse(string $localFilepath): static |
||
60 |