Conditions | 6 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
16 | public function compile(FormRuleContextBuilder $context) |
||
17 | { |
||
18 | $formGroups = $context->getGroups(); |
||
19 | foreach ($formGroups as $name => $groups) { |
||
20 | if ($groups !== null) { |
||
21 | continue; |
||
22 | } |
||
23 | |||
24 | // Find the closest validation group |
||
25 | $path = new PropertyPath($name); |
||
26 | do { |
||
27 | $parentName = (string) $path; |
||
28 | if (isset($formGroups[$parentName]) && ($groups = $formGroups[$parentName]) !== null) { |
||
29 | $context->addGroup($name, $groups); |
||
30 | break; |
||
31 | } |
||
32 | $path = $path->getParent(); |
||
33 | } while ($path !== null); |
||
34 | } |
||
35 | } |
||
36 | } |
||
37 |