PropRule   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 38
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getKey() 0 4 2
A getProp() 0 4 1
A getSet() 0 4 1
A getGetter() 0 4 1
A getType() 0 4 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace PTS\DataTransformer;
5
6
class PropRule
7
{
8
    /** @var array */
9
    protected $map;
10
11
    /**
12
     * @param array $map
13
     */
14 6
    public function __construct(array $map)
15
    {
16 6
        $this->map = $map;
17 6
    }
18
19 6
    public function getKey(string $name, $default = null)
20
    {
21 6
        return array_key_exists($name, $this->map) ? $this->map[$name] : $default;
22
    }
23
24 6
    public function getProp(string $default = null): ?string
25
    {
26 6
        return $this->getKey('prop', $default);
27
    }
28
29 2
    public function getSet()
30
    {
31 2
        return $this->getKey('set');
32
    }
33
34 4
    public function getGetter()
35
    {
36 4
        return $this->getKey('get');
37
    }
38
39 6
    public function getType(): ?string
40
    {
41 6
        return $this->getKey('type');
42
    }
43
}
44