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.

Publishable::published()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
ccs 6
cts 6
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace AloiaCms\Models\Traits;
5
6
use Illuminate\Support\Collection;
7
8
trait Publishable
9
{
10
    /**
11
     * Determine whether this article is published
12
     *
13
     * @return bool
14
     */
15 6
    public function isPublished(): bool
16
    {
17 6
        return $this->matter['is_published'] ?? false;
18
    }
19
20
    /**
21
     * Return all published models
22
     *
23
     * @return Collection
24
     */
25 4
    public static function published(): Collection
26
    {
27 4
        return self::all()
28 4
            ->filter(function ($model) {
29 4
                return $model->isPublished();
30 4
            })
31 4
            ->values();
32
    }
33
34
    /**
35
     * Determine whether this article is scheduled
36
     *
37
     * @return bool
38
     */
39 5
    public function isScheduled(): bool
40
    {
41 5
        return $this->matter['is_scheduled'] ?? false;
42
    }
43
44
    /**
45
     * Return all scheduled models
46
     *
47
     * @return Collection
48
     */
49 1
    public static function scheduled(): Collection
50
    {
51 1
        return self::all()
52 1
            ->filter(function ($model) {
53 1
                return $model->isScheduled();
54 1
            })
55 1
            ->values();
56
    }
57
}
58