Completed
Push — 6.13 ( fb0043...d86c76 )
by André
18:03
created

MapNormalizer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 8 1
A supportsNormalization() 0 4 1
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;
10
11
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Map;
12
use Symfony\Component\Serializer\Normalizer\PropertyNormalizer;
13
14
final class MapNormalizer extends PropertyNormalizer
15
{
16
    /**
17
     * @see \eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Map::__sleep
18
     */
19
    public function normalize($object, $format = null, array $context = [])
20
    {
21
        return [
22
            'key' => $object->getMapKey(),
23
            'map' => [],
24
            'reverseMap' => [],
25
        ];
26
    }
27
28
    public function supportsNormalization($data, $format = null)
29
    {
30
        return $data instanceof Map;
31
    }
32
}
33