1 | <?php |
||
2 | |||
3 | namespace SimpleDIC\Parser; |
||
4 | |||
5 | use Symfony\Component\Yaml\Yaml; |
||
6 | |||
7 | class YamlParser implements ParserInterface |
||
8 | { |
||
9 | /** |
||
10 | * @param string $filename |
||
11 | * |
||
12 | * @return array |
||
13 | * @throws \Exception |
||
14 | */ |
||
15 | public function parse($filename) |
||
16 | { |
||
17 | if (false === class_exists(Yaml::class)) { |
||
18 | throw new \Exception('YAML class was not found, you must install it. Run "composer require symfony/yaml"'); |
||
19 | } |
||
20 | |||
21 | return Yaml::parseFile($filename); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
22 | } |
||
23 | } |
||
24 |