Completed
Pull Request — master (#104)
by Mikael
03:15
created

FlexibleEntityNormalizer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 4 1
A supportsNormalization() 0 4 1
1
<?php
2
/*
3
 * This file is part of the PommProject/PommBundle package.
4
 *
5
 * (c) 2018 Grégoire HUBERT <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PommProject\PommBundle\Serializer\Normalizer;
11
12
use PommProject\ModelManager\Model\FlexibleEntity\FlexibleEntityInterface;
13
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
14
15
class FlexibleEntityNormalizer implements NormalizerInterface
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function normalize($object, $format = null, array $context = array())
21
    {
22
        return $object->extract();
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function supportsNormalization($data, $format = null)
29
    {
30
        return $data instanceof FlexibleEntityInterface;
31
    }
32
}
33