Completed
Push — main ( 407a1d...b509b5 )
by
unknown
17s queued 14s
created

InteractionTypeEnum   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 16
dl 0
loc 63
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getValues() 0 6 1
A isLove() 0 3 1
A isLike() 0 3 1
A getValuesAsStrings() 0 6 1
A isDislike() 0 3 1
1
<?php
2
3
namespace CSlant\LaravelLike\Enums;
4
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
18
    {
19
        return [
20
            self::LIKE,
21
            self::DISLIKE,
22
            self::LOVE,
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
66
    {
67
        return $this === self::LOVE;
68
    }
69
}
70