| Conditions | 4 |
| Paths | 1 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function configureOptions(OptionsResolver $resolver) |
||
| 28 | 4 | { |
|
| 29 | 4 | $resolver |
|
| 30 | 4 | ->setDefaults([ |
|
| 31 | 'children' => [], |
||
| 32 | 4 | 'attributes' => [ |
|
| 33 | 'class' => 'list-group cms-menu-'.$this->menuName, |
||
| 34 | ], |
||
| 35 | 4 | ]) |
|
| 36 | 4 | ->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 | 4 | } |
|
| 40 | 4 | ||
| 41 | 4 | foreach ($value as $item) { |
|
| 42 | 4 | 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 | 4 | } |
|
| 46 | 4 | ||
| 47 | return $value; |
||
| 48 | }) |
||
| 74 |