Completed
Push — master ( d8a1ad...d0379b )
by Dominik
02:06
created

DenormalizingFieldMapping::getGroups()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Deserialization\Mapping;
6
7
use Chubbyphp\Deserialization\Accessor\PropertyAccessor;
8
use Chubbyphp\Deserialization\Denormalizer\FieldDenormalizer;
9
use Chubbyphp\Deserialization\Denormalizer\FieldDenormalizerInterface;
10
11
final class DenormalizingFieldMapping implements DenormalizingFieldMappingInterface
12
{
13
    /**
14
     * @var string
15
     */
16
    private $name;
17
18
    /**
19
     * @var array
20
     */
21
    private $groups;
22
23
    /**
24
     * @var FieldDenormalizerInterface
25
     */
26
    private $fieldDenormalizer;
27
28
    /**
29
     * @param string                          $name
30
     * @param array                           $groups
31
     * @param FieldDenormalizerInterface|null $fieldDenormalizer
32
     */
33 4
    public function __construct($name, array $groups = [], FieldDenormalizerInterface $fieldDenormalizer = null)
0 ignored issues
show
Unused Code introduced by
The parameter $groups is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
34
    {
35 4
        $this->name = $name;
36 4
        $this->fieldDenormalizer = $fieldDenormalizer ?? new FieldDenormalizer(new PropertyAccessor($name));
37 4
    }
38
39
    /**
40
     * @return string
41
     */
42 4
    public function getName(): string
43
    {
44 4
        return $this->name;
45
    }
46
47
    /**
48
     * @return array
49
     */
50
    public function getGroups(): array
51
    {
52
        return $this->groups;
53
    }
54
55
    /**
56
     * @return FieldDenormalizerInterface
57
     */
58 4
    public function getFieldDenormalizer(): FieldDenormalizerInterface
59
    {
60 4
        return $this->fieldDenormalizer;
61
    }
62
}
63