| 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 (false == class_exists('Symfony\Component\Yaml\Yaml')) { |
||
|
|
|||
| 36 | throw new \RuntimeException('"Symfony Yaml" is required to read YAML 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 = Yaml::parse($resourceContent); |
||
| 47 | $repository = new Repository($parsedResource ?? []); |
||
| 48 | |||
| 49 | return $this->parseImports($repository, $resource); |
||
| 50 | } |
||
| 51 | |||
| 60 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.