Passed
Push — master ( f9c187...0868ed )
by Caen
02:55 queued 12s
created

PageSchema::constructPageSchema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Hyde\Framework\Concerns\FrontMatter\Schemas;
4
5
use JetBrains\PhpStorm\ArrayShape;
6
7
/**
8
 * These are the front matter properties that are supported for all* Hyde pages.
9
 * *Support for front matter in Blade pages is experimental.
10
 */
11
trait PageSchema
12
{
13
    /**
14
     * The title of the page used in the HTML <title> tag, among others.
15
     *
16
     * @example "Home", "About", "Blog Feed"
17
     * @yamlType string|optional
18
     */
19
    public string $title;
20
21
    /**
22
     * The settings for how the page should be presented in the navigation menu.
23
     * All array values are optional, as long as the array is not empty.
24
     *
25
     * @yamlType array|optional
26
     *
27
     * @example ```yaml
28
     * navigation:
29
     *   title: "Home"
30
     *   hidden: true
31
     *   priority: 1
32
     * ```
33
     */
34
    #[ArrayShape(['title' => 'string', 'hidden' => 'bool', 'priority' => 'int'])]
35
    public ?array $navigation = null;
36
37
    /**
38
     * The canonical URL of the page.
39
     *
40
     * @yamlType array|optional
41
     *
42
     * @example "https://example.com/about"
43
     */
44
    public ?string $canonicalUrl = null;
45
}
46