FieldNormalizer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 24
ccs 4
cts 4
cp 1
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A normalizeField() 0 7 1
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