Passed
Push — master ( ad6b2a...b41ca0 )
by Caen
07:45 queued 14s
created

Navigation::item()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 4
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hyde\Facades;
6
7
use function compact;
8
9
/**
10
 * General facade for navigation features.
11
 */
12
class Navigation
13
{
14
    /**
15
     * Configuration helper method to define a new navigation item, with better IDE support.
16
     *
17
     * The returned array will then be used by the framework to create a new NavigationItem instance. {@see \Hyde\Framework\Features\Navigation\NavigationItem}
18
     *
19
     * @see https://hydephp.com/docs/2.x/navigation-api
20
     *
21
     * @param  string<\Hyde\Support\Models\RouteKey>|string  $destination  Route key, or an external URI.
22
     * @param  string|null  $label  If not provided, Hyde will try to get it from the route's connected page, or from the URL.
23
     * @param  int|null  $priority  If not provided, Hyde will try to get it from the route or the default priority of 500.
24
     * @param  array<string, scalar>  $attributes  Additional attributes for the navigation item.
25
     * @return array{destination: string, label: ?string, priority: ?int, attributes: array<string, scalar>}
26
     */
27
    public static function item(string $destination, ?string $label = null, ?int $priority = null, array $attributes = []): array
28
    {
29
        return compact('destination', 'label', 'priority', 'attributes');
30
    }
31
}
32