Completed
Push — master ( f27e2e...5dd696 )
by Asmir
10s
created

FaultHandler::deserializeFaultDetail()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 9
cts 9
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 4
crap 2
1
<?php
2
namespace GoetasWebservices\SoapServices\SoapClient\Envelope\Handler;
3
4
use JMS\Serializer\DeserializationContext;
5
use JMS\Serializer\GraphNavigator;
6
use JMS\Serializer\Handler\SubscribingHandlerInterface;
7
use JMS\Serializer\XmlDeserializationVisitor;
8
9
class FaultHandler implements SubscribingHandlerInterface
10
{
11 32
    public static function getSubscribingMethods()
12
    {
13
        return array(
14
            array(
15 32
                'direction' => GraphNavigator::DIRECTION_DESERIALIZATION,
16 32
                'format' => 'xml',
17 32
                'type' => 'GoetasWebservices\SoapServices\SoapClient\Envelope\SoapEnvelope12\Parts\Fault\FaultDetail',
18
                'method' => 'deserializeFaultDetail'
19 32
            ),
20 32
        );
21
    }
22
23 2
    public function deserializeFaultDetail(XmlDeserializationVisitor $visitor, \SimpleXMLElement $data, array $type, DeserializationContext $context)
0 ignored issues
show
Unused Code introduced by
The parameter $visitor is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $type is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
24
    {
25 2
        $domElement = dom_import_simplexml($data);
26
27 2
        $document = new \DOMDocument('1.0', 'utf-8');
28
29 2
        $xml = '';
30 2
        foreach ($domElement->childNodes as $child) {
31 2
            $newEl = $document->importNode($child, true);
32 2
            $xml .= $document->saveXML($newEl);
33 2
        }
34 2
        return $xml;
35
    }
36
}
37
38
39
40