JobRegistry   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
cbo 0
dl 0
loc 63
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getNewJob() 0 4 1
A markJobComplete() 0 4 1
A addJob() 0 6 1
A count() 0 4 1
A getJobs() 0 4 1
A setJobs() 0 6 1
1
<?php
2
3
/**
4
 * This file is part of Bldr.io
5
 *
6
 * (c) Aaron Scherer <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE
10
 */
11
12
namespace Bldr\Registry;
13
14
use Bldr\Definition\JobDefinition;
15
16
/**
17
 * @author Aaron Scherer <[email protected]>
18
 */
19
class JobRegistry
20
{
21
    /**
22
     * @var JobDefinition[] $jobs
23
     */
24
    private $jobs;
25
26
    /**
27
     * @return JobDefinition|null
28
     */
29
    public function getNewJob()
30
    {
31
        return current($this->jobs);
32
    }
33
34
    /**
35
     *
36
     */
37
    public function markJobComplete()
38
    {
39
        array_shift($this->jobs);
40
    }
41
42
    /**
43
     * @param JobDefinition $job
44
     *
45
     * @return $this
46
     */
47
    public function addJob(JobDefinition $job)
48
    {
49
        $this->jobs[] = $job;
50
51
        return $this;
52
    }
53
54
    /**
55
     * @return int
56
     */
57
    public function count()
58
    {
59
        return count($this->jobs);
60
    }
61
62
    /**
63
     * @return JobDefinition[]
64
     */
65
    public function getJobs()
66
    {
67
        return $this->jobs;
68
    }
69
70
    /**
71
     * @param JobDefinition[] $jobs
72
     *
73
     * @return $this
74
     */
75
    public function setJobs(array $jobs)
76
    {
77
        $this->jobs = $jobs;
78
79
        return $this;
80
    }
81
}
82