FaultHandler::getSubscribingMethods()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace GoetasWebservices\SoapServices\SoapClient\Envelope\Handler;
4
5
use JMS\Serializer\DeserializationContext;
6
use JMS\Serializer\GraphNavigator;
7
use JMS\Serializer\Handler\SubscribingHandlerInterface;
8
use JMS\Serializer\XmlDeserializationVisitor;
9
10
class FaultHandler implements SubscribingHandlerInterface
11
{
12 36
    public static function getSubscribingMethods()
13
    {
14
        return array(
15
            array(
16 36
                'direction' => GraphNavigator::DIRECTION_DESERIALIZATION,
17 36
                'format' => 'xml',
18 36
                'type' => 'GoetasWebservices\SoapServices\SoapClient\Envelope\SoapEnvelope12\Parts\Fault\FaultDetail',
19
                'method' => 'deserializeFaultDetail'
20 36
            ),
21 36
        );
22
    }
23
24 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...
25
    {
26 2
        $domElement = dom_import_simplexml($data);
27
28 2
        $document = new \DOMDocument('1.0', 'utf-8');
29
30 2
        $xml = '';
31 2
        foreach ($domElement->childNodes as $child) {
32 2
            $newEl = $document->importNode($child, true);
33 2
            $xml .= $document->saveXML($newEl);
34 2
        }
35 2
        return $xml;
36
    }
37
}
38
39
40
41