AccessConfig   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 57.14%

Importance

Changes 0
Metric Value
wmc 5
eloc 11
dl 0
loc 42
ccs 8
cts 14
cp 0.5714
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setDefault() 0 5 1
A set() 0 5 1
A __construct() 0 4 1
A getDefaultGroups() 0 3 1
A getGroupsByProperty() 0 3 1
1
<?php
2
3
namespace Lneicelis\Transformer\ValueObject;
4
5
class AccessConfig
6
{
7
    /** @var string[] */
8
    private $defaultGroups = [];
9
10
    /** @var array[] */
11
    private $groupsByProperty = [];
12
13 5
    public function __construct(array $defaultGroups = [], array $groupsByProperty = [])
14
    {
15 5
        $this->defaultGroups = $defaultGroups;
16 5
        $this->groupsByProperty = $groupsByProperty;
17 5
    }
18
19
    public function setDefault(array $groups): AccessConfig
20
    {
21
        $this->defaultGroups = $groups;
22
23
        return $this;
24
    }
25
26
    public function set(string $property, array $groups): AccessConfig
27
    {
28
        $this->groupsByProperty[$property] = $groups;
29
30
        return $this;
31
    }
32
33
    /**
34
     * @return string[]
35
     */
36 5
    public function getDefaultGroups(): array
37
    {
38 5
        return $this->defaultGroups;
39
    }
40
41
    /**
42
     * @return array[]
43
     */
44 5
    public function getGroupsByProperty(): array
45
    {
46 5
        return $this->groupsByProperty;
47
    }
48
}
49