FaultHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 28
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribingMethods() 0 11 1
A deserializeFaultDetail() 0 13 2
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