Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
7 / 7 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
Job | |
100.00% |
7 / 7 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
getValue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getStart | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getEnd | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | /** |
3 | * Jingga |
4 | * |
5 | * PHP Version 8.1 |
6 | * |
7 | * @package phpOMS\Algorithm\JobScheduling |
8 | * @copyright Dennis Eichhorn |
9 | * @license OMS License 2.0 |
10 | * @version 1.0.0 |
11 | * @link https://jingga.app |
12 | */ |
13 | declare(strict_types=1); |
14 | |
15 | namespace phpOMS\Algorithm\JobScheduling; |
16 | |
17 | /** |
18 | * Job for scheduling |
19 | * |
20 | * @package phpOMS\Algorithm\JobScheduling |
21 | * @license OMS License 2.0 |
22 | * @link https://jingga.app |
23 | * @since 1.0.0 |
24 | */ |
25 | class Job implements JobInterface |
26 | { |
27 | /** |
28 | * Value of the job |
29 | * |
30 | * @var float |
31 | * @since 1.0.0 |
32 | */ |
33 | private float $value = 0.0; |
34 | |
35 | /** |
36 | * Start time of the job |
37 | * |
38 | * @var \DateTime |
39 | * @since 1.0.0 |
40 | */ |
41 | private \DateTime $start; |
42 | |
43 | /** |
44 | * End time of the job |
45 | * |
46 | * @var \DateTime |
47 | * @since 1.0.0 |
48 | */ |
49 | private ?\DateTime $end = null; |
50 | |
51 | /** |
52 | * Name of the job |
53 | * |
54 | * @var string |
55 | * @since 1.0.0 |
56 | */ |
57 | public string $name = ''; |
58 | |
59 | /** |
60 | * Cosntructor. |
61 | * |
62 | * @param float $value Value of the job |
63 | * @param \DateTime $start Start time of the job |
64 | * @param null|\DateTime $end End time of the job |
65 | * |
66 | * @since 1.0.0 |
67 | */ |
68 | public function __construct(float $value, \DateTime $start, ?\DateTime $end, string $name = '') |
69 | { |
70 | $this->value = $value; |
71 | $this->start = $start; |
72 | $this->end = $end; |
73 | $this->name = $name; |
74 | } |
75 | |
76 | /** |
77 | * {@inheritdoc} |
78 | */ |
79 | public function getValue() : float |
80 | { |
81 | return $this->value; |
82 | } |
83 | |
84 | /** |
85 | * {@inheritdoc} |
86 | */ |
87 | public function getStart() : \DateTime |
88 | { |
89 | return $this->start; |
90 | } |
91 | |
92 | /** |
93 | * {@inheritdoc} |
94 | */ |
95 | public function getEnd() : ?\DateTime |
96 | { |
97 | return $this->end; |
98 | } |
99 | } |