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

FieldDenormalizer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 33
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A denormalizeField() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Deserialization\Denormalizer;
6
7
use Chubbyphp\Deserialization\Accessor\AccessorInterface;
8
9
final class FieldDenormalizer implements FieldDenormalizerInterface
10
{
11
    /**
12
     * @var AccessorInterface
13
     */
14
    private $accessor;
15
16
    /**
17
     * @param AccessorInterface $accessor
18
     * @param array             $groups
0 ignored issues
show
Bug introduced by
There is no parameter named $groups. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
19
     */
20 4
    public function __construct(AccessorInterface $accessor)
21
    {
22 4
        $this->accessor = $accessor;
23 4
    }
24
25
    /**
26
     * @param string                            $path
27
     * @param object                            $object
28
     * @param mixed                             $value
29
     * @param DenormalizerInterface|null        $denormalizer
30
     * @param DenormalizerContextInterface|null $context
31
     */
32 4
    public function denormalizeField(
33
        string $path,
34
        $object,
35
        $value,
36
        DenormalizerInterface $denormalizer = null,
37
        DenormalizerContextInterface $context = null
38
    ) {
39 4
        $this->accessor->setValue($object, $value);
40 4
    }
41
}
42