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.
Completed
Push — master ( e97bb7...5f2eb5 )
by Pascal
10:40 queued 09:38
created

IsScheduled   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 60
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A eventMutex() 0 8 2
A event() 0 8 2
A isDue() 0 6 1
A schedule() 0 4 1
1
<?php
2
3
namespace ProtoneMedia\ApiHealth\Checkers;
4
5
use Illuminate\Console\Scheduling\CacheEventMutex;
6
use Illuminate\Console\Scheduling\Event;
7
use Illuminate\Console\Scheduling\EventMutex;
8
9
trait IsScheduled
10
{
11
    /**
12
     * Event object that is used to manages the frequency.
13
     *
14
     * @var \Illuminate\Console\Scheduling\Event
15
     */
16
    private $event;
17
18
    /**
19
     * Returns the EventMutex bound to the container or creates a new instance.
20
     *
21
     * @return \Illuminate\Console\Scheduling\EventMutex
22
     */
23
    private function eventMutex(): EventMutex
24
    {
25
        if (app()->bound(EventMutex::class)) {
26
            return app()->make(EventMutex::class);
27
        }
28
29
        return app()->make(CacheEventMutex::class);
30
    }
31
32
    /**
33
     * Returns the Event that is used to manages the frequency.
34
     *
35
     * @return \Illuminate\Console\Scheduling\Event
36
     */
37
    private function event(): Event
38
    {
39
        if (!$this->event) {
40
            $this->event = new Event($this->eventMutex(), '');
41
        }
42
43
        return $this->event;
44
    }
45
46
    /**
47
     * Determine if the checker is due to run based on the current date.
48
     *
49
     * @return bool
50
     */
51
    public function isDue(): bool
52
    {
53
        $this->schedule($this->event());
54
55
        return $this->event->isDue(app());
56
    }
57
58
    /**
59
     * Defines the checker's schedule.
60
     *
61
     * @param  \Illuminate\Console\Scheduling\Event  $event
62
     * @return void
63
     */
64
    public function schedule(Event $event)
65
    {
66
        $event->everyMinute();
67
    }
68
}
69