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

DoctrineObjectNormalizer::setAttributeValue()   B

Complexity

Conditions 6
Paths 6

Size

Total Lines 33
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 42

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 33
ccs 0
cts 19
cp 0
rs 8.439
cc 6
eloc 18
nc 6
nop 5
crap 42
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