Passed
Pull Request — master (#18)
by SignpostMarv
03:22
created

SchemaReader::loadComplexType()   C

Complexity

Conditions 14
Paths 12

Size

Total Lines 55
Code Lines 38

Duplication

Lines 9
Ratio 16.36 %

Code Coverage

Tests 43
CRAP Score 14

Importance

Changes 0
Metric Value
dl 9
loc 55
ccs 43
cts 43
cp 1
rs 6.7491
c 0
b 0
f 0
cc 14
eloc 38
nc 12
nop 3
crap 14

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace GoetasWebservices\XML\XSDReader;
4
5
use DOMElement;
6
7
class SchemaReader extends SchemaReaderLoadAbstraction
8
{
9
    /**
10
     * @param string $typeName
11
     *
12
     * @return mixed[]
13
     */
14 135
    protected static function splitParts(DOMElement $node, $typeName)
15
    {
16 135
        $prefix = null;
17 135
        $name = $typeName;
18 135
        if (strpos($typeName, ':') !== false) {
19 135
            list($prefix, $name) = explode(':', $typeName);
20 45
        }
21
22 135
        $namespace = $node->lookupNamespaceUri($prefix ?: '');
23
24
        return array(
25 135
            $name,
26 135
            $namespace,
27 135
            $prefix,
28 45
        );
29
    }
30
}
31