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

BlogPostSchema::constructBlogPostSchema()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Hyde\Framework\Concerns\FrontMatter\Schemas;
4
5
use Hyde\Framework\Models\Author;
6
use Hyde\Framework\Models\DateString;
7
use Hyde\Framework\Models\Image;
8
9
/**
10
 * These are the front matter properties that are supported for Hyde blog posts.
11
 */
12
trait BlogPostSchema
13
{
14
    /** @example "My New Post" */
15
    public string $title;
16
17
    /** @example "A short description" */
18
    public ?string $description = null;
19
20
    /** @example "general", "my favorite recipes" */
21
    public ?string $category = null;
22
23
    /**
24
     * The date the post was published.
25
     *
26
     * @example 'YYYY-MM-DD [HH:MM]' (Must be parsable by `strtotime()`)
27
     * @yamlType string|optional
28
     */
29
    public ?DateString $date = null;
30
31
    /**
32
     * @example See author section
33
     * @yamlType string|array|optional
34
     */
35
    public ?Author $author = null;
36
37
    /**
38
     * @yamlType string|array|optional
39
     *
40
     * @example "image.jpg" # Expanded by Hyde to `_media/image.jpg` and is resolved automatically
41
     * @example "https://cdn.example.com/image.jpg" # Full URL starting with `http(s)://`)
42
     * @example ```yaml
43
     * image:
44
     *   path: image.jpg
45
     *   uri: https://cdn.example.com/image.jpg # Takes precedence over `path`
46
     *   description: 'Alt text for image'
47
     *   title: 'Tooltip title'
48
     *   copyright: 'Copyright (c) 2022'
49
     *   license: 'CC-BY-SA-4.0'
50
     *   licenseUrl: https://example.com/license/
51
     *   credit: https://photographer.example.com/
52
     *   author: 'John Doe'
53
     * ```
54
     */
55
    public ?Image $image = null;
56
}
57