Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
33 | public function load(string $resource, string $type = null) : RepositoryInterface |
||
34 | { |
||
35 | if (class_exists('Yosymfony\Toml\Toml') === false) { |
||
36 | throw new \RuntimeException('"Yosymfony Toml" is required to read TOML files.'); |
||
37 | } |
||
38 | |||
39 | $resourceContent = $resource; |
||
40 | |||
41 | if (empty($type)) { |
||
42 | $file = $this->getLocation($resource); |
||
43 | $resourceContent = $this->readFile($file); |
||
44 | } |
||
45 | |||
46 | $parsedResource = Toml::parse($resourceContent); |
||
47 | $repository = new Repository($parsedResource ?? []); |
||
48 | |||
49 | return $this->parseImports($repository, $resource); |
||
50 | } |
||
51 | |||
60 |