Total Complexity | 5 |
Total Lines | 63 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | enum InteractionTypeEnum: string |
||
6 | { |
||
7 | case DEFAULT = 'default'; |
||
8 | case LIKE = 'like'; |
||
9 | case DISLIKE = 'dislike'; |
||
10 | case LOVE = 'love'; |
||
11 | |||
12 | /** |
||
13 | * Get the values of the enum. |
||
14 | * |
||
15 | * @return array<int, InteractionTypeEnum> |
||
16 | */ |
||
17 | public static function getValues(): array |
||
23 | ]; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Get the values of the enum as strings. |
||
28 | * |
||
29 | * @return array<string> |
||
30 | */ |
||
31 | public static function getValuesAsStrings(): array |
||
32 | { |
||
33 | return [ |
||
34 | self::LIKE->value, |
||
35 | self::DISLIKE->value, |
||
36 | self::LOVE->value, |
||
37 | ]; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Check if the value is like. |
||
42 | * |
||
43 | * @return bool |
||
44 | */ |
||
45 | public function isLike(): bool |
||
46 | { |
||
47 | return $this === self::LIKE; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Check if the value is dislike. |
||
52 | * |
||
53 | * @return bool |
||
54 | */ |
||
55 | public function isDislike(): bool |
||
56 | { |
||
57 | return $this === self::DISLIKE; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * Check if the value is love. |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | public function isLove(): bool |
||
68 | } |
||
69 | } |
||
70 |