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

SchemaReader::loadSequence()   C

Complexity

Conditions 12
Paths 60

Size

Total Lines 32
Code Lines 24

Duplication

Lines 6
Ratio 18.75 %

Code Coverage

Tests 28
CRAP Score 12

Importance

Changes 0
Metric Value
dl 6
loc 32
ccs 28
cts 28
cp 1
rs 5.1612
c 0
b 0
f 0
cc 12
eloc 24
nc 60
nop 3
crap 12

How to fix   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