Total Complexity | 9 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | final class SwapDirection |
||
14 | { |
||
15 | /** @var string */ |
||
16 | private $value; |
||
17 | |||
18 | /** @var array<string, self> */ |
||
19 | private static $instances = []; |
||
20 | |||
21 | private const FORWARD = 'forward'; |
||
22 | private const REWIND = 'rewind'; |
||
23 | |||
24 | private function __construct(string $value) |
||
25 | { |
||
26 | $this->value = $value; |
||
27 | } |
||
28 | |||
29 | public function getValue(): string |
||
32 | } |
||
33 | |||
34 | public function getDateTimeDirection(): string |
||
35 | { |
||
36 | switch ($this->value) { |
||
37 | case self::REWIND: |
||
38 | return 'previous'; |
||
39 | case self::FORWARD: |
||
40 | return 'next'; |
||
41 | } |
||
42 | |||
43 | return ''; |
||
44 | } |
||
45 | |||
46 | public static function forward(): self |
||
53 | } |
||
54 | |||
55 | public static function rewind(): self |
||
62 | } |
||
63 | } |
||
64 |