| Conditions | 4 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function __construct(string $filepath) |
||
| 30 | { |
||
| 31 | $stream = file_get_contents($filepath); |
||
| 32 | |||
| 33 | // Check if the file has Front Matter. |
||
| 34 | if (str_starts_with($stream, '---')) { |
||
| 35 | $object = YamlFrontMatter::markdownCompatibleParse($stream); |
||
| 36 | |||
| 37 | if ($object->matter()) { |
||
| 38 | $this->matter = $object->matter(); |
||
| 39 | } |
||
| 40 | |||
| 41 | if ($object->body()) { |
||
| 42 | $this->body = $object->body(); |
||
| 43 | } |
||
| 44 | } else { |
||
| 45 | $this->body = $stream; |
||
| 46 | } |
||
| 57 |