| Conditions | 6 |
| Paths | 6 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 40 | 134 | protected function findInDescendent($haystack, string ...$location) |
|
| 41 | { |
||
| 42 | 134 | if (0 === count($location)) { |
|
| 43 | 134 | return $haystack; |
|
| 44 | } |
||
| 45 | 134 | $search = array_shift($location); |
|
| 46 | 134 | if (is_array($haystack)) { |
|
| 47 | 2 | return (isset($haystack[$search])) ? $this->findInDescendent($haystack[$search], ...$location) : null; |
|
| 48 | } |
||
| 49 | 134 | if ($haystack instanceof stdClass) { |
|
| 50 | 134 | return (isset($haystack->{$search})) ? $this->findInDescendent($haystack->{$search}, ...$location) : null; |
|
| 51 | } |
||
| 52 | 1 | throw new InvalidArgumentException('Cannot find descendent on non-array non-object haystack'); |
|
| 53 | } |
||
| 60 |