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