PolicyEnforcement   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 41
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getAction() 0 4 1
A getReason() 0 4 1
A create() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Model\Callback;
6
7
class PolicyEnforcement
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $action;
13
14
    /**
15
     * @var string|null
16
     */
17
    protected $reason;
18
19
    /**
20
     * PolicyEnforcement constructor.
21
     */
22 1
    public function __construct(string $action, ?string $reason = null)
23
    {
24 1
        $this->action = $action;
25 1
        $this->reason = $reason;
26 1
    }
27
28 1
    public function getAction(): string
29
    {
30 1
        return $this->action;
31
    }
32
33 1
    public function getReason(): ?string
34
    {
35 1
        return $this->reason;
36
    }
37
38
    /**
39
     * @return \Kerox\Messenger\Model\Callback\PolicyEnforcement
40
     */
41 1
    public static function create(array $callbackData): self
42
    {
43 1
        $reason = $callbackData['reason'] ?? null;
44
45 1
        return new self($callbackData['action'], $reason);
46
    }
47
}
48