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 |
||
33 | 10 | public function parse(string $frontMatter) |
|
34 | { |
||
35 | 10 | if (! \extension_loaded('yaml')) { |
|
36 | throw new MissingDependencyException('Failed to parse yaml: "ext-yaml" extension is missing'); |
||
37 | } |
||
38 | |||
39 | 10 | $result = @\yaml_parse($frontMatter); |
|
40 | |||
41 | 10 | if ($result === false) { |
|
42 | 2 | throw new InvalidFrontMatterException('Failed to parse front matter'); |
|
43 | } |
||
44 | |||
45 | 8 | return $result; |
|
46 | } |
||
48 |