| Conditions | 4 |
| Paths | 4 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function findConfig($templatePath, $key = null): array |
||
| 22 | { |
||
| 23 | if (is_file($this->getConfigPath($templatePath)) === false) { |
||
| 24 | throw new \InvalidArgumentException( |
||
| 25 | sprintf('Template "%s" with key "%s" not found', $templatePath, $key) |
||
| 26 | ); |
||
| 27 | } |
||
| 28 | |||
| 29 | if ($key === null) { |
||
| 30 | return []; |
||
| 31 | } |
||
| 32 | |||
| 33 | $config = $this->loadConfig($templatePath); |
||
| 34 | |||
| 35 | if (isset($config[$key])) { |
||
| 36 | return $config[$key]; |
||
| 37 | } |
||
| 38 | |||
| 39 | throw new \InvalidArgumentException( |
||
| 40 | sprintf('Template "%s" with key "%s" not found', $templatePath, $key) |
||
| 41 | ); |
||
| 42 | } |
||
| 43 | |||
| 62 |