Completed
Push — EZP-31681 ( 54659b...e049ce )
by
unknown
18:38 queued 10s
created

CompoundMatcherNormalizer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 8 1
A getAllowedProperties() 0 4 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
namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;
8
9
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher;
10
11
class CompoundMatcherNormalizer extends AbstractPropertyWhitelistNormalizer
12
{
13
    /**
14
     * @see \eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Compound::__sleep.
15
     */
16
    public function normalize($object, $format = null, array $context = [])
17
    {
18
        $data = parent::normalize($object, $format, $context);
19
        $data['config'] = [];
20
        $data['matchersMap'] = [];
21
22
        return $data;
23
    }
24
25
    protected function getAllowedProperties()
26
    {
27
        return ['subMatchers'];
28
    }
29
30
    public function supportsNormalization($data, $format = null)
31
    {
32
        return $data instanceof Matcher\Compound;
33
    }
34
}
35