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

FieldDenormalizer::denormalizeField()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 3
cts 3
cp 1
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 5
crap 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