Completed
Push — master ( 98c39c...c8155d )
by Pavel
16:50
created

DoctrineObjectNormalizer::supportsNormalization()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2.5

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 4
cp 0.5
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 2
crap 2.5
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 13
    public function setRegistry(ManagerRegistry $registry)
14
    {
15 13
        $this->registry = $registry;
16 13
    }
17
18 13
    public function supportsNormalization($data, $format = null)
19
    {
20 13
        return \is_object($data) && null !== $this->registry->getManagerForClass(\get_class($data));
21
    }
22
}
23