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