| Conditions | 8 |
| Paths | 8 |
| Total Lines | 24 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 8 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 1 | public function resolve(array $options, array $context): array |
|
| 23 | { |
||
| 24 | 1 | foreach ($options as $optionName => $optionValue) { |
|
| 25 | 1 | if (is_array($optionValue)) { |
|
| 26 | 1 | $options[$optionName] = $this->resolve($optionValue, $context); |
|
| 27 | 1 | } elseif (!is_string($optionValue)) { |
|
| 28 | 1 | continue; |
|
| 29 | 1 | } elseif (false !== strpos($optionValue, '@!')) { |
|
| 30 | 1 | $key = substr($optionValue, 2); |
|
| 31 | 1 | list($firstLevel, $secondLevel) = explode('->', $key); |
|
| 32 | |||
| 33 | 1 | if (isset($context[$firstLevel][$secondLevel])) { |
|
| 34 | 1 | $options[$optionName] = $context[$firstLevel][$secondLevel]; |
|
| 35 | } |
||
| 36 | 1 | } elseif (false !== strpos($optionValue, '@')) { |
|
| 37 | 1 | $key = substr($optionValue, 1); |
|
| 38 | |||
| 39 | 1 | if ($this->accessor->isReadable($context, $key)) { |
|
| 40 | 1 | $options[$optionName] = $this->accessor->getValue($context, $key); |
|
| 41 | } |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | 1 | return $options; |
|
| 46 | } |
||
| 48 |