| Conditions | 3 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 11 | public static function getElements(\DOMNodeList $nodeList, ?string $nodeName): array |
|
| 19 | { |
||
| 20 | 11 | $els = array_filter(iterator_to_array($nodeList), function ($node) use ($nodeName) { |
|
| 21 | 11 | if (! $node instanceof \DOMElement) { |
|
| 22 | 10 | return false; |
|
| 23 | } |
||
| 24 | |||
| 25 | 11 | if (! $nodeName) { |
|
| 26 | 4 | return true; |
|
| 27 | } |
||
| 28 | |||
| 29 | 7 | return $node->nodeName === $nodeName; |
|
| 30 | }); |
||
| 31 | |||
| 32 | 11 | return array_values($els); |
|
| 33 | } |
||
| 35 |