Code Duplication    Length = 74-74 lines in 2 locations

src/Mapping/NormalizationFieldMapping.php 1 location

@@ 11-84 (lines=74) @@
8
use Chubbyphp\Serialization\Policy\PolicyInterface;
9
use Chubbyphp\Serialization\Policy\NullPolicy;
10
11
final class NormalizationFieldMapping implements NormalizationFieldMappingInterface
12
{
13
    /**
14
     * @var string
15
     */
16
    private $name;
17
18
    /**
19
     * @var array
20
     */
21
    private $groups;
22
23
    /**
24
     * @var FieldNormalizerInterface
25
     */
26
    private $fieldNormalizer;
27
28
    /**
29
     * @var PolicyInterface
30
     */
31
    private $policy;
32
33
    /**
34
     * @param string                   $name
35
     * @param array                    $groups
36
     * @param FieldNormalizerInterface $fieldNormalizer
37
     * @param PolicyInterface|null     $policy
38
     */
39
    public function __construct(
40
        $name,
41
        array $groups,
42
        FieldNormalizerInterface $fieldNormalizer,
43
        PolicyInterface $policy = null
44
    ) {
45
        $this->name = $name;
46
        $this->groups = $groups;
47
        $this->fieldNormalizer = $fieldNormalizer;
48
        $this->policy = $policy ?? new NullPolicy();
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getName(): string
55
    {
56
        return $this->name;
57
    }
58
59
    /**
60
     * @deprecated
61
     *
62
     * @return string[]
63
     */
64
    public function getGroups(): array
65
    {
66
        return $this->groups;
67
    }
68
69
    /**
70
     * @return FieldNormalizerInterface
71
     */
72
    public function getFieldNormalizer(): FieldNormalizerInterface
73
    {
74
        return $this->fieldNormalizer;
75
    }
76
77
    /**
78
     * @return PolicyInterface
79
     */
80
    public function getPolicy(): PolicyInterface
81
    {
82
        return $this->policy;
83
    }
84
}
85

src/Mapping/NormalizationLinkMapping.php 1 location

@@ 11-84 (lines=74) @@
8
use Chubbyphp\Serialization\Policy\PolicyInterface;
9
use Chubbyphp\Serialization\Policy\NullPolicy;
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
    /**
34
     * @param string                  $name
35
     * @param array                   $groups
36
     * @param LinkNormalizerInterface $linkNormalizer
37
     * @param PolicyInterface|null    $policy
38
     */
39
    public function __construct(
40
        string $name,
41
        array $groups,
42
        LinkNormalizerInterface $linkNormalizer,
43
        PolicyInterface $policy = null
44
    ) {
45
        $this->name = $name;
46
        $this->groups = $groups;
47
        $this->linkNormalizer = $linkNormalizer;
48
        $this->policy = $policy ?? new NullPolicy();
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getName(): string
55
    {
56
        return $this->name;
57
    }
58
59
    /**
60
     * @deprecated
61
     *
62
     * @return string[]
63
     */
64
    public function getGroups(): array
65
    {
66
        return $this->groups;
67
    }
68
69
    /**
70
     * @return LinkNormalizerInterface
71
     */
72
    public function getLinkNormalizer(): LinkNormalizerInterface
73
    {
74
        return $this->linkNormalizer;
75
    }
76
77
    /**
78
     * @return PolicyInterface
79
     */
80
    public function getPolicy(): PolicyInterface
81
    {
82
        return $this->policy;
83
    }
84
}
85