Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| MenuItem | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Menu; |
| 4 | |
| 5 | class MenuItem |
| 6 | { |
| 7 | public string $id; |
| 8 | public string $label; |
| 9 | public ?string $route; |
| 10 | /** |
| 11 | * @var array<mixed>|null |
| 12 | */ |
| 13 | public ?array $routeParams; |
| 14 | public ?string $url; |
| 15 | /** |
| 16 | * @var array<mixed>|null |
| 17 | */ |
| 18 | public ?array $options; |
| 19 | /** |
| 20 | * @var MenuItem[]|null |
| 21 | */ |
| 22 | public ?array $subItems; |
| 23 | |
| 24 | /** |
| 25 | * Make an item for the menu. |
| 26 | * |
| 27 | * @param string $id id of menu item |
| 28 | * @param string|null $label label of menu item |
| 29 | * @param string|null $route route of menu item |
| 30 | * @param array<mixed>|null $routeParams route parameters of the menu item |
| 31 | * @param array<mixed>|null $options options of item |
| 32 | * @param MenuItem[]|null $subItems list of subItems |
| 33 | */ |
| 34 | public function __construct( |
| 35 | string $id, |
| 36 | ?string $label = null, |
| 37 | ?string $route = null, |
| 38 | ?array $routeParams = [], |
| 39 | ?array $options = [], |
| 40 | ?array $subItems = [], |
| 41 | ) { |
| 42 | $this->id = $id; |
| 43 | $this->label = $label ?: $id; |
| 44 | $this->route = $route; |
| 45 | $this->routeParams = $routeParams; |
| 46 | $this->options = $options; |
| 47 | $this->subItems = $subItems; |
| 48 | } |
| 49 | } |