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

SchemaReaderFindAbstraction::findSomeType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 3
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 1
rs 9.6666
c 0
b 0
f 0
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