Passed
Push — master ( c708c9...af9ac4 )
by Bas
39s
created

SoapDateHandler::getSubscribingMethods()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 21
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 13
nc 2
nop 0
dl 0
loc 21
ccs 14
cts 14
cp 1
crap 2
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
namespace DMT\Soap\Serializer;
4
5
use JMS\Serializer\GraphNavigator;
6
use JMS\Serializer\Handler\DateHandler;
7
8
class SoapDateHandler extends DateHandler
9
{
10 17
    public static function getSubscribingMethods()
11
    {
12 17
        $methods = [];
13
14 17
        foreach (['DateTime', 'DateTimeImmutable', 'DateInterval'] as $type) {
15 17
            $methods[] = [
16 17
                'type' => $type,
17 17
                'direction' => GraphNavigator::DIRECTION_DESERIALIZATION,
18 17
                'format' => 'soap',
19 17
                'method' => 'deserialize' . $type . 'FromXml'
20
            ];
21
22 17
            $methods[] = [
23 17
                'type' => $type,
24 17
                'format' => 'soap',
25 17
                'direction' => GraphNavigator::DIRECTION_SERIALIZATION,
26 17
                'method' => 'serialize' . $type,
27
            ];
28
        }
29
30 17
        return $methods;
31
    }
32
}
33