Conditions | 6 |
Paths | 5 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | 40 | public static function findField(array $fields, string $fieldName, bool $allowPanels = false): ?Field |
|
19 | { |
||
20 | 40 | foreach ($fields as $field) { |
|
21 | 40 | if ($allowPanels && $field instanceof Panel) { |
|
22 | 2 | $panelField = self::findField($field->data, $fieldName, $allowPanels); |
|
23 | 2 | if ($panelField instanceof Field) { |
|
24 | 2 | return $panelField; |
|
25 | } |
||
26 | 40 | } elseif (self::fieldMatches($field, $fieldName)) { |
|
27 | 40 | return $field; |
|
28 | } |
||
29 | } |
||
30 | |||
31 | 5 | return null; |
|
32 | } |
||
49 |