Completed
Push — master ( 06e52a...98c39c )
by Pavel
13:39 queued 10:37
created

DoctrineObjectNormalizer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setRegistry() 0 4 1
A supportsNormalization() 0 4 2
1
<?php
2
3
namespace ScayTrase\Api\Cruds\Adaptors\DoctrineOrm;
4
5
use Doctrine\Common\Persistence\ManagerRegistry;
6
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
7
8
final class DoctrineObjectNormalizer extends ObjectNormalizer
9
{
10
    /** @var ManagerRegistry */
11
    private $registry;
12
13
    public function setRegistry(ManagerRegistry $registry)
14
    {
15
        $this->registry = $registry;
16
    }
17
18
    public function supportsNormalization($data, $format = null)
19
    {
20
        return \is_object($data) && null !== $this->registry->getManagerForClass(\get_class($data));
21
    }
22
}
23