Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3.0261 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | 8 | public function parse(string $frontMatter) |
|
33 | { |
||
34 | 8 | if (! \extension_loaded('yaml')) { |
|
35 | throw new \RuntimeException('Failed to parse yaml: "ext-yaml" extension is missing'); |
||
36 | } |
||
37 | |||
38 | 8 | $result = @\yaml_parse($frontMatter); |
|
39 | |||
40 | 8 | if ($result === false) { |
|
41 | 2 | throw new InvalidFrontMatterException('Failed to parse front matter'); |
|
42 | } |
||
43 | |||
44 | 6 | return $result; |
|
45 | } |
||
47 |