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

getFieldDenormalizer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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