Passed
Push — master ( 82657f...9be19c )
by Dominik
01:56
created

FieldDenormalizer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
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 29
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 1
    public function __construct(AccessorInterface $accessor)
17
    {
18 1
        $this->accessor = $accessor;
19 1
    }
20
21
    /**
22
     * @param string                       $path
23
     * @param object                       $object
24
     * @param mixed                        $value
25
     * @param DenormalizerContextInterface $context
26
     * @param DenormalizerInterface|null   $denormalizer
27
     */
28 1
    public function denormalizeField(
29
        string $path,
30
        $object,
31
        $value,
32
        DenormalizerContextInterface $context,
33
        DenormalizerInterface $denormalizer = null
34
    ) {
35 1
        $this->accessor->setValue($object, $value);
36 1
    }
37
}
38