| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 77 | 5 | public function getValueByKey($fileName, $key, $replacements = []) |
|
| 78 | { |
||
| 79 | 5 | $fileContent = $this->get($fileName); |
|
| 80 | |||
| 81 | 5 | if (!array_key_exists($key, $fileContent)) { |
|
| 82 | 1 | throw new \Exception("Key: '{$key}' does not exist in file: {$fileName}"); |
|
| 83 | } |
||
| 84 | |||
| 85 | 4 | $found = $fileContent[$key]; |
|
| 86 | |||
| 87 | 4 | return (new StringUtility())->applyReplacements($found, $replacements); |
|
| 88 | } |
||
| 89 | } |
||
| 90 |