Total Complexity | 10 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | final class Task |
||
17 | { |
||
18 | private $id; |
||
19 | private $state; |
||
20 | private $data; |
||
21 | |||
22 | 156 | private function __construct(int $id, string $state, $data) |
|
23 | { |
||
24 | 156 | $this->id = $id; |
|
25 | 156 | $this->state = $state; |
|
26 | 156 | $this->data = $data; |
|
27 | 156 | } |
|
28 | |||
29 | 156 | public static function fromTuple(array $tuple) : self |
|
30 | { |
||
31 | 156 | [$id, $state, $data] = $tuple + [2 => null]; |
|
32 | |||
33 | 156 | return new self($id, $state, $data); |
|
34 | } |
||
35 | |||
36 | 142 | public function getId() : int |
|
37 | { |
||
38 | 142 | return $this->id; |
|
39 | } |
||
40 | |||
41 | 126 | public function getState() : string |
|
44 | } |
||
45 | |||
46 | 140 | public function getData() |
|
47 | { |
||
48 | 140 | return $this->data; |
|
49 | } |
||
50 | |||
51 | 10 | public function isReady() : bool |
|
52 | { |
||
53 | 10 | return States::READY === $this->state; |
|
54 | } |
||
55 | |||
56 | 10 | public function isTaken() : bool |
|
57 | { |
||
58 | 10 | return States::TAKEN === $this->state; |
|
59 | } |
||
60 | |||
61 | 10 | public function isDone() : bool |
|
62 | { |
||
63 | 10 | return States::DONE === $this->state; |
|
64 | } |
||
65 | |||
66 | 10 | public function isBuried() : bool |
|
67 | { |
||
68 | 10 | return States::BURIED === $this->state; |
|
69 | } |
||
70 | |||
71 | 10 | public function isDelayed() : bool |
|
74 | } |
||
75 | } |
||
76 |