Reaction   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 78
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getReaction() 0 4 1
A getEmoji() 0 4 1
A getAction() 0 4 1
A getMid() 0 4 1
A create() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Model\Callback;
6
7
class Reaction
8
{
9
    public const REACTION_SMILE = 'smile';
10
    public const REACTION_ANGRY = 'angry';
11
    public const REACTION_SAD = 'sad';
12
    public const REACTION_WOW = 'wow';
13
    public const REACTION_LOVE = 'love';
14
    public const REACTION_LIKE = 'like';
15
    public const REACTION_DISLIKE = 'dislike';
16
    public const REACTION_OTHER = 'other';
17
18
    public const ACTION_REACT = 'react';
19
    public const ACTION_UNREACT = 'unreact';
20
21
    /**
22
     * @var string
23
     */
24
    protected $reaction;
25
26
    /**
27
     * @var string
28
     */
29
    protected $emoji;
30
31
    /**
32
     * @var string
33
     */
34
    protected $action;
35
36
    /**
37
     * @var string
38
     */
39
    protected $mid;
40
41
    /**
42
     * Reaction constructor.
43
     */
44 1
    public function __construct(string $reaction, string $emoji, string $action, string $mid)
45
    {
46 1
        $this->reaction = $reaction;
47 1
        $this->emoji = $emoji;
48 1
        $this->action = $action;
49 1
        $this->mid = $mid;
50 1
    }
51
52 1
    public function getReaction(): string
53
    {
54 1
        return $this->reaction;
55
    }
56
57 1
    public function getEmoji(): string
58
    {
59 1
        return $this->emoji;
60
    }
61
62 1
    public function getAction(): string
63
    {
64 1
        return $this->action;
65
    }
66
67 1
    public function getMid(): string
68
    {
69 1
        return $this->mid;
70
    }
71
72
    /**
73
     * @return \Kerox\Messenger\Model\Callback\Reaction
74
     */
75 1
    public static function create(array $callbackData): self
76
    {
77 1
        return new self(
78 1
            $callbackData['reaction'],
79 1
            $callbackData['emoji'],
80 1
            $callbackData['action'],
81 1
            $callbackData['mid']
82
        );
83
    }
84
}
85