Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| MarkdownDocument | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Hyde\Framework\Models; |
| 4 | |
| 5 | use Hyde\Framework\Concerns\HasDynamicTitle; |
| 6 | use Hyde\Framework\Contracts\AbstractPage; |
| 7 | |
| 8 | /** |
| 9 | * The base class for all Markdown-based Page Models. |
| 10 | * |
| 11 | * It is, in itself an intermediate object model created by the MarkdownFileService |
| 12 | * and contains the Front Matter and Markdown body found in a document processed by the service. |
| 13 | */ |
| 14 | class MarkdownDocument extends AbstractPage |
| 15 | { |
| 16 | use HasDynamicTitle; |
| 17 | |
| 18 | public array $matter; |
| 19 | public string $body; |
| 20 | public string $title; |
| 21 | public string $slug; |
| 22 | |
| 23 | public static string $fileExtension = '.md'; |
| 24 | |
| 25 | /** |
| 26 | * Construct the class. |
| 27 | * |
| 28 | * @param array $matter |
| 29 | * @param string $body |
| 30 | * @param string $title |
| 31 | * @param string $slug |
| 32 | */ |
| 33 | public function __construct(array $matter, string $body, string $title = '', string $slug = '') |
| 34 | { |
| 35 | $this->matter = $matter; |
| 36 | $this->body = $body; |
| 37 | $this->title = $title; |
| 38 | $this->slug = $slug; |
| 39 | } |
| 40 | } |