DenormalizationFieldMapping   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 13
c 0
b 0
f 0
dl 0
loc 60
ccs 10
cts 10
cp 1
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A __construct() 0 10 1
A getGroups() 0 3 1
A getPolicy() 0 3 1
A getFieldDenormalizer() 0 3 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
     */
38
    public function __construct(
39
        $name,
40
        array $groups = [],
41 4
        FieldDenormalizerInterface $fieldDenormalizer,
42
        PolicyInterface $policy = null
43
    ) {
44
        $this->name = $name;
45
        $this->groups = $groups;
0 ignored issues
show
Deprecated Code introduced by
The property Chubbyphp\Deserializatio...onFieldMapping::$groups has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

45
        /** @scrutinizer ignore-deprecated */ $this->groups = $groups;
Loading history...
46
        $this->fieldDenormalizer = $fieldDenormalizer;
47 4
        $this->policy = $policy ?? new NullPolicy();
48 4
    }
49 4
50 4
    public function getName(): string
51 4
    {
52
        return $this->name;
53
    }
54
55
    /**
56 1
     * @deprecated
57
     */
58 1
    public function getGroups(): array
59
    {
60
        return $this->groups;
0 ignored issues
show
Deprecated Code introduced by
The property Chubbyphp\Deserializatio...onFieldMapping::$groups has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

60
        return /** @scrutinizer ignore-deprecated */ $this->groups;
Loading history...
61
    }
62
63
    public function getFieldDenormalizer(): FieldDenormalizerInterface
64
    {
65
        return $this->fieldDenormalizer;
66 1
    }
67
68 1
    public function getPolicy(): PolicyInterface
69
    {
70
        return $this->policy;
71
    }
72
}
73