Conditions | 4 |
Paths | 1 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | public function configureOptions(OptionsResolver $resolver) |
||
28 | { |
||
29 | $resolver |
||
30 | ->setDefaults([ |
||
31 | 'children' => [], |
||
32 | 'attributes' => [ |
||
33 | 'class' => 'list-group cms-menu-'.$this->menuName, |
||
34 | ], |
||
35 | ]) |
||
36 | ->setNormalizer('children', function (Options $options, $value) { |
||
37 | if (!is_array($value)) { |
||
38 | throw new Exception('The menu items should an array for menu "'.$this->menuName.'"'); |
||
39 | } |
||
40 | |||
41 | foreach ($value as $item) { |
||
42 | if (!$item instanceof MenuItemConfiguration) { |
||
43 | throw new Exception(sprintf('The menu items should an array of "%s" for menu "%s"', MenuItemConfiguration::class, $this->menuName)); |
||
44 | } |
||
45 | } |
||
46 | |||
47 | return $value; |
||
48 | }) |
||
74 |