Completed
Push — EZP-31287 ( fe8c5c...af9523 )
by
unknown
34:01
created

SimplifiedRequestNormalizer::normalize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 3
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
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\Routing\SimplifiedRequest;
10
use Symfony\Component\Serializer\Normalizer\PropertyNormalizer;
11
12
final class SimplifiedRequestNormalizer extends PropertyNormalizer
13
{
14
    /**
15
     * @see \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize
16
     *
17
     * @param \eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest $object
18
     */
19
    public function normalize($object, $format = null, array $context = [])
20
    {
21
        return [
22
            'scheme' => $object->scheme,
23
            'host' => $object->host,
24
            'port' => $object->port,
25
            'pathinfo' => $object->pathinfo,
26
            'queryParams' => $object->queryParams,
27
            'languages' => $object->languages,
28
            'headers' => [],
29
        ];
30
    }
31
32
    public function supportsNormalization($data, $format = null, array $context = [])
33
    {
34
        return $data instanceof SimplifiedRequest;
35
    }
36
}
37