PaginatorNormalizer::normalize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Apie\PaginationPlugin\Normalizers;
4
5
use Pagerfanta\Pagerfanta;
6
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
7
use Symfony\Component\Serializer\SerializerAwareInterface;
8
use Symfony\Component\Serializer\SerializerAwareTrait;
9
10
class PaginatorNormalizer implements NormalizerInterface, SerializerAwareInterface
11
{
12
    use SerializerAwareTrait;
13
14
    public function normalize($object, $format = null, array $context = [])
15
    {
16
        /** @var Pagerfanta $object */
17
        return $this->serializer->normalize($object->getCurrentPageResults(), $format, $context);
18
    }
19
20
    public function supportsNormalization($data, $format = null)
21
    {
22
        return $data instanceof Pagerfanta;
23
    }
24
}
25