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.

IsScheduled   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 58
rs 10
c 0
b 0
f 0
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A eventMutex() 0 7 2
A schedule() 0 3 1
A isDue() 0 5 1
A event() 0 7 2
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());
0 ignored issues
show
Bug introduced by
app() of type Illuminate\Container\Container is incompatible with the type Illuminate\Contracts\Foundation\Application expected by parameter $app of Illuminate\Console\Scheduling\Event::isDue(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

55
        return $this->event->isDue(/** @scrutinizer ignore-type */ app());
Loading history...
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