DateFieldNormalizer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 26
ccs 4
cts 4
cp 1
rs 10
c 2
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A normalizeField() 0 9 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Serialization\Normalizer;
6
7
/**
8
 * @deprecated use Chubbyphp\Serialization\Normalizer\DateTimeFieldNormalizer
9
 */
10
final class DateFieldNormalizer implements FieldNormalizerInterface
11
{
12
    /**
13
     * @var FieldNormalizerInterface
14
     */
15
    private $fieldNormalizer;
16
17
    public function __construct(FieldNormalizerInterface $fieldNormalizer, string $format = 'c')
18
    {
19
        $this->fieldNormalizer = new DateTimeFieldNormalizer($fieldNormalizer, $format);
20
    }
21 4
22
    /**
23 4
     * @param object $object
24 4
     *
25
     * @return mixed
26
     */
27
    public function normalizeField(
28
        string $path,
29
        $object,
30
        NormalizerContextInterface $context,
31
        NormalizerInterface $normalizer = null
32
    ) {
33
        @trigger_error(sprintf('Use %s instead', DateTimeFieldNormalizer::class), E_USER_DEPRECATED);
34 4
35
        return $this->fieldNormalizer->normalizeField($path, $object, $context, $normalizer);
36
    }
37
}
38