Passed
Pull Request — master (#13)
by Dominik
03:26
created

DenormalizationFieldMapping   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 85.71%

Importance

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

5 Methods

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