Completed
Pull Request — master (#12)
by Dominik
07:37 queued 14s
created

NormalizationFieldMapping   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
dl 0
loc 68
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0
ccs 12
cts 14
cp 0.8571
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getName() 0 4 1
A getGroups() 0 4 1
A getFieldNormalizer() 0 4 1
A getPermission() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Serialization\Mapping;
6
7
use Chubbyphp\Serialization\Normalizer\FieldNormalizerInterface;
8
9
final class NormalizationFieldMapping implements NormalizationFieldMappingInterface
10
{
11
    /**
12
     * @var string
13
     */
14
    private $name;
15
16
    /**
17
     * @var array
18
     */
19
    private $groups;
20
21
    /**
22
     * @var FieldNormalizerInterface
23
     */
24
    private $fieldNormalizer;
25
26
    /**
27
     * @var object|string|null
28
     */
29
    private $permission;
30
31
    /**
32
     * @param string                   $name
33
     * @param array                    $groups
34
     * @param FieldNormalizerInterface $fieldNormalizer
35
     * @param object|string|null       $permission
36
     */
37 3
    public function __construct($name, array $groups, FieldNormalizerInterface $fieldNormalizer, $permission = null)
38
    {
39 3
        $this->name = $name;
40 3
        $this->groups = $groups;
41 3
        $this->fieldNormalizer = $fieldNormalizer;
42 3
        $this->permission = $permission;
43 3
    }
44
45
    /**
46
     * @return string
47
     */
48 1
    public function getName(): string
49
    {
50 1
        return $this->name;
51
    }
52
53
    /**
54
     * @return string[]
55
     */
56 1
    public function getGroups(): array
57
    {
58 1
        return $this->groups;
59
    }
60
61
    /**
62
     * @return FieldNormalizerInterface
63
     */
64 1
    public function getFieldNormalizer(): FieldNormalizerInterface
65
    {
66 1
        return $this->fieldNormalizer;
67
    }
68
69
    /**
70
     * @return object|string|null
71
     */
72
    public function getPermission()
73
    {
74
        return $this->permission;
75
    }
76
}
77