GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (32)

src/Models/Page.php (1 issue)

1
<?php
2
3
namespace AloiaCms\Models;
4
5
use AloiaCms\HtmlParser;
6
use AloiaCms\Models\Contracts\ModelInterface;
7
use AloiaCms\Models\Contracts\PublishInterface;
8
use AloiaCms\Models\Traits\Postable;
9
use AloiaCms\Models\Traits\Publishable;
10
use AloiaCms\Models\Traits\Updatable;
11
12
class Page extends Model implements ModelInterface, PublishInterface
13
{
14
    use Publishable, Postable, Updatable;
15
16
    protected $folder = 'pages';
17
18
    protected $required_fields = [
19
        'title',
20
        'description',
21
        'post_date',
22
        'is_published',
23
        'is_scheduled',
24
        'summary',
25
        'template_name'
26
    ];
27
28
    /**
29
     * Determine whether this article is scheduled
30
     *
31
     * @return bool
32
     */
33 2
    public function isHomepage(): bool
34
    {
35 2
        return $this->matter['is_homepage'] ?? false;
36
    }
37
38
    /**
39
     * Get the page that's marked as the homepage
40
     *
41
     * @return Page|null
42
     */
43 2
    public static function homepage(): ?Page
44
    {
45 2
        return Page::published()
46 2
            ->filter(function (Page $page) {
47 2
                return $page->isHomepage();
48 2
            })
49 2
            ->first();
50
    }
51
52
    /**
53
     * Get the title of this resource
54
     *
55
     * @return string
56
     * @throws \Exception
57
     */
58 2
    public function title(): string
59
    {
60 2
        return $this->matter['title'];
61
    }
62
63
    /**
64
     * Get the description of this resource
65
     *
66
     * @return string
67
     * @throws \Exception
68
     */
69 1
    public function description(): string
70
    {
71 1
        return $this->matter['description'];
72
    }
73
74
    /**
75
     * Get the summary of this page
76
     *
77
     * @return string
78
     */
79 1
    public function summary(): string
80
    {
81 1
        return $this->matter['summary'] ?? '';
82
    }
83
84
    /**
85
     * Get the template name of this page
86
     *
87
     * @return string
88
     */
89 1
    public function templateName(): string
90
    {
91 1
        return $this->matter['template_name'] ?? 'default';
92
    }
93
94
    /**
95
     * Get the type of this page
96
     *
97
     * @return string
98
     */
99 1
    public function type(): string
100
    {
101 1
        return "website";
102
    }
103
104
    /**
105
     * Get the main image of this page
106
     *
107
     * @return string
108
     * @throws \Exception
109
     */
110 1
    public function image(): string
111
    {
112 1
        return $this->matter['image'] ?? "";
113
    }
114
115
    /**
116
     * Get the path to the thumbnail of this page
117
     *
118
     * @return string
119
     * @throws \Exception
120
     */
121 1
    public function thumbnail(): string
122
    {
123 1
        return $this->matter['image'] ?? "";
124
    }
125
126
    /**
127
     * Determine whether this page is in the menu
128
     *
129
     * @return bool
130
     */
131 1
    public function isInMenu(): bool
132
    {
133 1
        return $this->matter['in_menu'] ?? false;
134
    }
135
136
    /**
137
     * Get the menu name of the page
138
     *
139
     * @return string
140
     * @throws \Exception
141
     */
142 1
    public function menuName(): string
143
    {
144 1
        return $this->matter['menu_name'] ?? $this->title();
145
    }
146
147
    /**
148
     * Get the meta data for this page
149
     *
150
     * @return array|null
151
     */
152 1
    public function metaData(): ?array
153
    {
154 1
        return $this->matter['meta_data'] ?? null;
155
    }
156
157
    /**
158
     * Get the author of this page
159
     *
160
     * @return string
161
     */
162 1
    public function author(): string
163
    {
164 1
        return $this->matter['author'] ?? '';
165
    }
166
167
    /**
168
     * Get the canonical if it's set
169
     *
170
     * @return null|string
171
     */
172 1
    public function canonicalLink(): ?string
173
    {
174 1
        return $this->matter['canonical'] ?? null;
175
    }
176
177
    /**
178
     * Get the url of this page
179
     *
180
     * @return string
181
     */
182 1
    public function url(): string
183
    {
184 1
        return $this->matter['url'] ?? $this->file_name;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->matter['url'] ?? $this->file_name could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
185
    }
186
}
187