Kernel   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 33
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 6 1
A run() 0 10 3
A getTasks() 0 4 1
1
<?php
2
3
namespace Infinitypaul\LaravelUptime\Scheduler;
4
5
class Kernel
6
{
7
    //The Task
8
    protected $tasks = [];
9
10
    //Add an Event
11
    public function add(Task $task)
12
    {
13
        $this->tasks[] = $task;
14
15
        return $task;
16
    }
17
18
    //Run The Schedule Tasked
19
20
    public function run()
21
    {
22
        foreach ($this->getTasks() as $task) {
23
            if (! $task->isDueToRun()) {
24
                continue;
25
            }
26
27
            $task->handle();
28
        }
29
    }
30
31
    //Get Tasks
32
33
    protected function getTasks()
34
    {
35
        return $this->tasks;
36
    }
37
}
38