FieldNormalizer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Serialization\Normalizer;
6
7
use Chubbyphp\Serialization\Accessor\AccessorInterface;
8
9
final class FieldNormalizer implements FieldNormalizerInterface
10
{
11
    /**
12
     * @var AccessorInterface
13
     */
14
    private $accessor;
15
16
    public function __construct(AccessorInterface $accessor)
17
    {
18
        $this->accessor = $accessor;
19 1
    }
20
21 1
    /**
22 1
     * @param object $object
23
     *
24
     * @return mixed
25
     */
26
    public function normalizeField(
27
        string $path,
28
        $object,
29
        NormalizerContextInterface $context,
30
        NormalizerInterface $normalizer = null
31
    ) {
32 1
        return $this->accessor->getValue($object);
33
    }
34
}
35