Passed
Pull Request — master (#18)
by SignpostMarv
03:07
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 45
    protected static function splitParts(DOMElement $node, $typeName)
15
    {
16 45
        $prefix = null;
17 45
        $name = $typeName;
18 45
        if (strpos($typeName, ':') !== false) {
19 45
            list($prefix, $name) = explode(':', $typeName);
20 45
        }
21
22 45
        $namespace = $node->lookupNamespaceUri($prefix ?: '');
23
24
        return array(
25 45
            $name,
26 45
            $namespace,
27 45
            $prefix,
28 45
        );
29
    }
30
}
31