Effect   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 63.64%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 37
ccs 7
cts 11
cp 0.6364
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A getEffect() 0 4 1
A isAllow() 0 4 1
A isDeny() 0 4 1
1
<?php
2
3
namespace tomzx\PolicyEvaluator;
4
5
class Effect
6
{
7
    /**
8
     * @var string
9
     */
10
    private $effect;
11
12
    /**
13
     * @param string $effect
14
     */
15 13
    public function __construct($effect)
16
    {
17 13
        if (!in_array($effect, ['Allow', 'Deny'])) {
18 2
            throw new \InvalidArgumentException('Effect must be either "Allow" or "Deny".');
19
        }
20
21 11
        $this->effect = $effect;
22 11
    }
23
24
    /**
25
     * @return string
26
     */
27
    public function getEffect()
28
    {
29
        return $this->effect;
30
    }
31
32
    public function isAllow()
33
    {
34
        return $this->effect === 'Allow';
35
    }
36
37 6
    public function isDeny()
38
    {
39 6
        return $this->effect === 'Deny';
40
    }
41
}
42