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

SchemaReaderFindAbstraction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 40
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A findSomeType() 0 9 1
A findSomeTypeFromAttribute() 0 16 1
1
<?php
2
3
namespace GoetasWebservices\XML\XSDReader;
4
5
use DOMElement;
6
use GoetasWebservices\XML\XSDReader\Schema\SchemaItem;
7
8
abstract class SchemaReaderFindAbstraction extends SchemaReaderCallbackAbstraction
9
{
10
    /**
11
     * @param string $attributeName
12
     *
13
     * @return SchemaItem
14
     */
15 135
    protected function findSomeType(
16
        SchemaItem $fromThis,
17
        DOMElement $node,
18
        $attributeName
19
    ) {
20 135
        return $this->findSomeTypeFromAttribute(
21 135
            $fromThis,
22 135
            $node,
23 135
            $node->getAttribute($attributeName)
24 45
        );
25
    }
26
27
    /**
28
     * @param string $attributeName
29
     *
30
     * @return SchemaItem
31
     */
32 135
    protected function findSomeTypeFromAttribute(
33
        SchemaItem $fromThis,
34
        DOMElement $node,
35
        $attributeName
36
    ) {
37
        /**
38
         * @var SchemaItem
39
         */
40 135
        $out = $this->findSomething(
41 135
            'findType',
42 135
            $fromThis->getSchema(),
43 135
            $node,
44 90
            $attributeName
45 45
        );
46
47 135
        return $out;
48
    }
49
}
50