| Total Complexity | 5 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class YamlLoader implements LoaderInterface |
||
| 9 | { |
||
| 10 | public static function isSupported(): bool |
||
|
|
|||
| 11 | { |
||
| 12 | return class_exists(Parser::class); |
||
| 13 | } |
||
| 14 | |||
| 15 | /** @var Parser */ |
||
| 16 | private $parser; |
||
| 17 | |||
| 18 | public function __construct(Parser $parser = null) |
||
| 19 | { |
||
| 20 | $this->parser = $parser ?? new Parser(); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function load(string $path): array |
||
| 24 | { |
||
| 25 | if (is_file("$path.yaml")) { |
||
| 26 | return $this->parser->parse(file_get_contents("$path.yaml")); |
||
| 27 | } |
||
| 28 | |||
| 29 | return []; |
||
| 30 | } |
||
| 31 | |||
| 32 | public function unload(string $path, array $data) { |
||
| 35 | } |
||
| 36 | } |
||
| 37 |