Test Failed
Branch develop (7f369c)
by Nicolas
04:26
created

DateTimeNormalizer::normalize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Serializer\Normalizer;
4
5
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
6
7
/**
8
 * DateTimeNormalizer.
9
 */
10
class DateTimeNormalizer implements NormalizerInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function normalize($object, $format = null, array $context = [])
16
    {
17
        /* @var \DateTime $object */
18
19
        return $object->format(\DateTime::ATOM);
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function supportsNormalization($data, $format = null)
26
    {
27
        return $data instanceof \DateTime;
28
    }
29
}
30