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.

Manager   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 12
lcom 1
cbo 2
dl 0
loc 86
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A addCrontab() 0 10 2
A runInForeground() 0 12 2
A runInBackground() 0 10 2
A wait() 0 6 2
A terminate() 0 6 2
A kill() 0 6 2
1
<?php
2
3
namespace Sid\Phalcon\Cron;
4
5
use DateTime;
6
7
class Manager extends \Sid\Cron\Manager
8
{
9
    /**
10
     * For background jobs.
11
     */
12
    protected $processes = [];
13
14
15
16
    public function addCrontab(string $filename)
17
    {
18
        $crontab = new CrontabParser($filename);
19
20
        $jobs = $crontab->getJobs();
21
22
        foreach ($jobs as $job) {
23
            $this->add($job);
24
        }
25
    }
26
27
28
29
    /**
30
     * Run all due jobs in the foreground.
31
     */
32
    public function runInForeground(DateTime $now = null) : array
33
    {
34
        $jobs = $this->getDueJobs($now);
35
36
        $outputs = [];
37
38
        foreach ($jobs as $job) {
39
            $outputs[] = $job->runInForeground();
40
        }
41
42
        return $outputs;
43
    }
44
45
    /**
46
     * Run all due jobs in the background.
47
     */
48
    public function runInBackground(DateTime $now = null) : array
49
    {
50
        $jobs = $this->getDueJobs($now);
51
52
        foreach ($jobs as $job) {
53
            $this->processes[] = $job->runInBackground();
54
        }
55
56
        return $this->processes;
57
    }
58
59
60
61
    /**
62
     * Wait for all jobs running in the background to finish.
63
     */
64
    public function wait()
65
    {
66
        foreach ($this->processes as $process) {
67
            $process->wait();
68
        }
69
    }
70
71
72
73
    /**
74
     * Terminate all jobs running in the background.
75
     */
76
    public function terminate()
77
    {
78
        foreach ($this->processes as $process) {
79
            $process->terminate();
80
        }
81
    }
82
83
    /**
84
     * Kill all jobs running in the background.
85
     */
86
    public function kill()
87
    {
88
        foreach ($this->processes as $process) {
89
            $process->kill();
90
        }
91
    }
92
}
93