SerializerProcessor   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 21
ccs 0
cts 8
cp 0
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A updateEntity() 0 4 1
1
<?php
2
3
namespace ScayTrase\Api\Cruds\Adaptors\Symfony;
4
5
use ScayTrase\Api\Cruds\EntityProcessorInterface;
6
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
7
8
final class SerializerProcessor implements EntityProcessorInterface
9
{
10
    /** @var  DenormalizerInterface */
11
    private $denormalizer;
12
13
    /**
14
     * SerializerProcessor constructor.
15
     *
16
     * @param DenormalizerInterface $denormalizer
17
     */
18
    public function __construct(DenormalizerInterface $denormalizer)
19
    {
20
        $this->denormalizer = $denormalizer;
21
    }
22
23
    /** {@inheritdoc} */
24
    public function updateEntity($entity, $data)
25
    {
26
        return $this->denormalizer->denormalize($data, get_class($entity), null, ['object_to_populate' => $entity]);
27
    }
28
}
29