AccessConfig::getDefaultGroups()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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