NormalizationLinkMapping::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 3
cts 3
cp 1
crap 1
rs 10
c 1
b 0
f 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Serialization\Mapping;
6
7
use Chubbyphp\Serialization\Normalizer\LinkNormalizerInterface;
8
use Chubbyphp\Serialization\Policy\NullPolicy;
9
use Chubbyphp\Serialization\Policy\PolicyInterface;
10
11
final class NormalizationLinkMapping implements NormalizationLinkMappingInterface
12
{
13
    /**
14
     * @var string
15
     */
16
    private $name;
17
18
    /**
19
     * @var array
20
     */
21
    private $groups;
22
23
    /**
24
     * @var LinkNormalizerInterface
25
     */
26
    private $linkNormalizer;
27
28
    /**
29
     * @var PolicyInterface
30
     */
31
    private $policy;
32
33
    public function __construct(
34
        string $name,
35
        array $groups,
36
        LinkNormalizerInterface $linkNormalizer,
37
        PolicyInterface $policy = null
38
    ) {
39 4
        $this->name = $name;
40
        $this->groups = $groups;
41
        $this->linkNormalizer = $linkNormalizer;
42
        $this->policy = $policy ?? new NullPolicy();
43
    }
44
45 4
    public function getName(): string
46 4
    {
47 4
        return $this->name;
48 4
    }
49 4
50
    /**
51
     * @deprecated
52
     *
53
     * @return string[]
54 1
     */
55
    public function getGroups(): array
56 1
    {
57
        return $this->groups;
58
    }
59
60
    public function getLinkNormalizer(): LinkNormalizerInterface
61
    {
62
        return $this->linkNormalizer;
63
    }
64 1
65
    public function getPolicy(): PolicyInterface
66 1
    {
67
        return $this->policy;
68
    }
69
}
70