FlexibleEntityNormalizer   A
last analyzed

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 Pomm's SymfonyBidge package.
4
 *
5
 * (c) 2014 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\SymfonyBridge\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;
0 ignored issues
show
Bug introduced by
The class PommProject\ModelManager...FlexibleEntityInterface does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
31
    }
32
}
33