Total Complexity | 6 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | class Yaml |
||
10 | { |
||
11 | /** |
||
12 | * @param $path |
||
13 | * @throws \InvalidArgumentException |
||
14 | * @return null|array on error |
||
15 | */ |
||
16 | 3 | public static function file($path) |
|
17 | { |
||
18 | 3 | if (!LibFs::isReadableFile($path)) { |
|
19 | 1 | throw new \InvalidArgumentException( |
|
20 | 1 | sprintf("not a readable file: '%s'", $path) |
|
21 | ); |
||
22 | } |
||
23 | |||
24 | 2 | return self::parser()->parseFile($path); |
|
25 | } |
||
26 | |||
27 | /** |
||
28 | * @param string $buffer |
||
29 | * @return null|array |
||
30 | */ |
||
31 | 1 | public static function buffer($buffer) |
|
32 | { |
||
33 | 1 | return self::parser()->parseBuffer($buffer); |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * @return ParserInterface |
||
38 | */ |
||
39 | 3 | private static function parser() |
|
55 | } |
||
56 | } |
||
57 |