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