Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
10 / 10 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| NavMeta | |
100.00% |
10 / 10 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| array | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Cosray; |
| 6 | |
| 7 | final class NavMeta |
| 8 | { |
| 9 | /** |
| 10 | * @param array{id: string, args: array<array-key, mixed>}|null $icon |
| 11 | */ |
| 12 | public function __construct( |
| 13 | public string $label, |
| 14 | public ?array $icon = null, |
| 15 | public ?string $badge = null, |
| 16 | public ?string $permission = null, |
| 17 | public bool $hidden = false, |
| 18 | public int $order = 0, |
| 19 | ) {} |
| 20 | |
| 21 | public function array(): array |
| 22 | { |
| 23 | return [ |
| 24 | 'label' => $this->label, |
| 25 | 'icon' => $this->icon['id'] ?? null, |
| 26 | 'iconMeta' => $this->icon, |
| 27 | 'badge' => $this->badge, |
| 28 | 'permission' => $this->permission, |
| 29 | 'hidden' => $this->hidden, |
| 30 | 'order' => $this->order, |
| 31 | ]; |
| 32 | } |
| 33 | } |