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

SchemaReader::loadImport()   C

Complexity

Conditions 11
Paths 7

Size

Total Lines 46
Code Lines 27

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 25
CRAP Score 11.8766

Importance

Changes 0
Metric Value
dl 0
loc 46
ccs 25
cts 31
cp 0.8065
rs 5.2653
c 0
b 0
f 0
cc 11
eloc 27
nc 7
nop 2
crap 11.8766

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