Total Complexity | 9 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
18 | class ChargeState |
||
19 | { |
||
20 | const STATE_NEW = 'new'; |
||
21 | const STATE_FINISHED = 'finished'; |
||
22 | |||
23 | /** @var string */ |
||
24 | protected $state; |
||
25 | |||
26 | private function __construct(string $state = self::STATE_NEW) |
||
27 | { |
||
28 | $this->state = $state; |
||
29 | } |
||
30 | |||
31 | public function getName() |
||
32 | { |
||
33 | return $this->state; |
||
34 | } |
||
35 | |||
36 | public function isNew() |
||
37 | { |
||
38 | return $this->state === self::STATE_NEW; |
||
39 | } |
||
40 | |||
41 | public function isFinished() |
||
42 | { |
||
43 | return $this->state === self::STATE_FINISHED; |
||
44 | } |
||
45 | |||
46 | public static function new() |
||
49 | } |
||
50 | |||
51 | public static function finished() |
||
52 | { |
||
53 | return new self(self::STATE_FINISHED); |
||
54 | } |
||
55 | |||
56 | public static function fromString(string $name) |
||
65 | } |
||
66 | } |
||
67 |