| Conditions | 4 |
| Paths | 1 |
| Total Lines | 25 |
| Code Lines | 15 |
| 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( |
||
| 44 | 'The menu items should an array of "%s" for menu "%s"', |
||
| 45 | MenuItemConfiguration::class, |
||
| 46 | $this->menuName) |
||
| 47 | ); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | return $value; |
||
| 52 | }) |
||
| 78 |