Passed
Push — master ( 265f32...0e6955 )
by Dominik
02:02 queued 12s
created

DenormalizationFieldMapping::getPolicy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

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
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
use Chubbyphp\Deserialization\Policy\NullPolicy;
9
use Chubbyphp\Deserialization\Policy\PolicyInterface;
10
11
final class DenormalizationFieldMapping implements DenormalizationFieldMappingInterface
12
{
13
    /**
14
     * @var string
15
     */
16
    private $name;
17
18
    /**
19
     * @deprecated
20
     *
21
     * @var array
22
     */
23
    private $groups;
24
25
    /**
26
     * @var FieldDenormalizerInterface
27
     */
28
    private $fieldDenormalizer;
29
30
    /**
31
     * @var PolicyInterface
32
     */
33
    private $policy;
34
35
    /**
36
     * @param string                     $name
37
     * @param array                      $groups
38
     * @param FieldDenormalizerInterface $fieldDenormalizer
39
     * @param PolicyInterface|null       $policy
40
     */
41 4
    public function __construct(
42
        $name,
43
        array $groups = [],
44
        FieldDenormalizerInterface $fieldDenormalizer,
45
        PolicyInterface $policy = null
46
    ) {
47 4
        $this->name = $name;
48 4
        $this->groups = $groups;
0 ignored issues
show
Deprecated Code introduced by
The property Chubbyphp\Deserializatio...onFieldMapping::$groups has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
49 4
        $this->fieldDenormalizer = $fieldDenormalizer;
50 4
        $this->policy = $policy ?? new NullPolicy();
51 4
    }
52
53
    /**
54
     * @return string
55
     */
56 1
    public function getName(): string
57
    {
58 1
        return $this->name;
59
    }
60
61
    /**
62
     * @deprecated
63
     *
64
     * @return array
65
     */
66 1
    public function getGroups(): array
67
    {
68 1
        return $this->groups;
0 ignored issues
show
Deprecated Code introduced by
The property Chubbyphp\Deserializatio...onFieldMapping::$groups has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
69
    }
70
71
    /**
72
     * @return FieldDenormalizerInterface
73
     */
74 1
    public function getFieldDenormalizer(): FieldDenormalizerInterface
75
    {
76 1
        return $this->fieldDenormalizer;
77
    }
78
79
    /**
80
     * @return PolicyInterface
81
     */
82 1
    public function getPolicy(): PolicyInterface
83
    {
84 1
        return $this->policy;
85
    }
86
}
87