Completed
Push — master ( 99fd04...6a3a72 )
by Jakub
02:38
created

supportsDenormalization()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
declare(strict_types=1);
3
4
namespace Eps\Req2CmdBundle\Serializer;
5
6
use Eps\Req2CmdBundle\Command\DeserializableCommandInterface;
7
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
8
9
class DeserializableCommandDenormalizer implements DenormalizerInterface
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function denormalize($data, $class, $format = null, array $context = [])
15
    {
16
        return call_user_func($class . '::fromArray', $data);
17
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function supportsDenormalization($data, $type, $format = null): bool
23
    {
24
        return is_subclass_of($type, DeserializableCommandInterface::class);
0 ignored issues
show
Bug introduced by
Due to PHP Bug #53727, is_subclass_of might return inconsistent results on some PHP versions if \Eps\Req2CmdBundle\Comma...CommandInterface::class can be an interface. If so, you could instead use ReflectionClass::implementsInterface.
Loading history...
25
    }
26
}
27