Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
NavMeta
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 array
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Cosray;
6
7final 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    /** @return array<string, mixed> */
22    public function array(): array
23    {
24        return [
25            'label' => $this->label,
26            'icon' => $this->icon['id'] ?? null,
27            'iconMeta' => $this->icon,
28            'badge' => $this->badge,
29            'permission' => $this->permission,
30            'hidden' => $this->hidden,
31            'order' => $this->order,
32        ];
33    }
34}