StdClassNormalizer::supportsNormalization()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the DbImporter package.
4
 *
5
 * (c) Mauro Cassani<https://github.com/mauretto78>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace DbImporter\Normalizer;
12
13
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
14
15
class StdClassNormalizer implements NormalizerInterface
16
{
17
    /**
18
     * @param object $object
19
     * @param null $format
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $format is correct as it would always require null to be passed?
Loading history...
20
     * @param array $context
21
     * @return array
22
     */
23
    public function normalize($object, $format = null, array $context = array())
24
    {
25
        return get_object_vars($object);
26
    }
27
28
    /**
29
     * @param mixed $data
30
     * @param null $format
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $format is correct as it would always require null to be passed?
Loading history...
31
     * @return bool
32
     */
33
    public function supportsNormalization($data, $format = null)
34
    {
35
        return $data instanceof \StdClass;
36
    }
37
}
38