GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PolicyRule   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setName() 0 6 1
A getName() 0 4 1
A addPolicyRuleAttribute() 0 8 2
A removePolicyRuleAttribute() 0 8 2
A getPolicyRuleAttributes() 0 4 1
1
<?php
2
3
namespace PhpAbac\Model;
4
5
class PolicyRule
6
{
7
    /** @var string **/
8
    protected $name;
9
    /** @var array<PhpAbac\Model\PolicyRuleAttribute> **/
10
    protected $policyRuleAttributes;
11
12 6
    public function __construct()
13
    {
14 6
        $this->policyRuleAttributes = [];
15 6
    }
16
17
    /**
18
     * @param string $name
19
     *
20
     * @return \PhpAbac\Model\PolicyRule
21
     */
22 6
    public function setName($name)
23
    {
24 6
        $this->name = $name;
25
26 6
        return $this;
27
    }
28
29
    /**
30
     * @return string
31
     */
32 2
    public function getName()
33
    {
34 2
        return $this->name;
35
    }
36
37
    /**
38
     * @param PolicyRuleAttribute $pra
39
     *
40
     * @return \PhpAbac\Model\PolicyRule
41
     */
42 6
    public function addPolicyRuleAttribute(PolicyRuleAttribute $pra)
43
    {
44 6
        if (!in_array($pra, $this->policyRuleAttributes, true)) {
45 6
            $this->policyRuleAttributes[] = $pra;
46 6
        }
47
48 6
        return $this;
49
    }
50
51
    /**
52
     * @param PolicyRuleAttribute $pra
53
     *
54
     * @return \PhpAbac\Model\PolicyRule
55
     */
56 1
    public function removePolicyRuleAttribute(PolicyRuleAttribute $pra)
57
    {
58 1
        if (($key = array_search($pra, $this->policyRuleAttributes)) !== false) {
59 1
            unset($this->policyRuleAttributes[$key]);
60 1
        }
61
62 1
        return $this;
63
    }
64
65
    /**
66
     * @return \PhpAbac\Model\PolicyRuleAttribute[]
67
     */
68 6
    public function getPolicyRuleAttributes()
69
    {
70 6
        return $this->policyRuleAttributes;
71
    }
72
}
73