ArrayFormat   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 16
c 0
b 0
f 0
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 4 1
A unserialize() 0 8 2
1
<?php
2
namespace Thunder\Serializard\Format;
3
4
use Thunder\Serializard\Exception\UnserializationFailureException;
5
use Thunder\Serializard\HydratorContainer\HydratorContainerInterface as Hydrators;
6
use Thunder\Serializard\NormalizerContainer\NormalizerContainerInterface as Normalizers;
7
use Thunder\Serializard\NormalizerContext\NormalizerContextInterface;
8
9
/**
10
 * @author Tomasz Kowalczyk <[email protected]>
11
 */
12
final class ArrayFormat extends AbstractFormat
13
{
14 5
    public function serialize($var, Normalizers $normalizers, NormalizerContextInterface $context)
15
    {
16 5
        return $this->doSerialize($var, $normalizers, $context);
17
    }
18
19 3
    public function unserialize($var, $class, Hydrators $hydrators)
20
    {
21 3
        if(false === \is_array($var)) {
22 1
            throw new UnserializationFailureException('ArrayFormat can unserialize only arrays!');
23
        }
24
25 2
        return $this->doUnserialize($var, $class, $hydrators);
26
    }
27
}
28