Completed
Push — master ( 607289...edbd19 )
by Pavel
01:31
created

DoctrineObjectNormalizer::getAssociationValue()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3.072

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 4
cts 5
cp 0.8
rs 9.4285
cc 3
eloc 5
nc 2
nop 2
crap 3.072
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
class DoctrineObjectNormalizer extends ObjectNormalizer
9
{
10
    /** @var ManagerRegistry */
11
    private $registry;
12
13 6
    public function setRegistry(ManagerRegistry $registry)
14
    {
15 6
        $this->registry = $registry;
16 6
    }
17
18 6
    public function supportsNormalization($data, $format = null)
19
    {
20 6
        return is_object($data) && null !== $this->registry->getManagerForClass(get_class($data));
21
    }
22
}
23