Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
MenuItem
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3namespace App\Menu;
4
5class 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}

Branches

Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once. Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

MenuItem->__construct
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    }