Passed
Branch decouple-schema-constructors (7e448c)
by Caen
02:54
created

PageSchema::makeCanonicalUrl()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 5
nc 3
nop 0
dl 0
loc 11
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 Hyde Markdown pages.
9
 */
10
trait PageSchema
11
{
12
    /**
13
     * The title of the page used in the HTML <title> tag, among others.
14
     *
15
     * @example "Home", "About", "Blog Feed"
16
     * @yamlType string|optional
17
     */
18
    public string $title;
19
20
    /**
21
     * The settings for how the page should be presented in the navigation menu.
22
     * All array values are optional, as long as the array is not empty.
23
     *
24
     * @yamlType array|optional
25
     *
26
     * @example ```yaml
27
     * navigation:
28
     *   title: "Home"
29
     *   hidden: true
30
     *   priority: 1
31
     * ```
32
     */
33
    #[ArrayShape(['title' => 'string', 'hidden' => 'bool', 'priority' => 'int'])]
34
    public ?array $navigation = null;
35
36
    /**
37
     * The canonical URL of the page.
38
     *
39
     * @yamlType array|optional
40
     *
41
     * @example "https://example.com/about"
42
     */
43
    public ?string $canonicalUrl = null;
44
}
45