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   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 48
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A isPublished() 0 3 1
A isScheduled() 0 3 1
A scheduled() 0 7 1
A published() 0 7 1
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