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

SchemaReaderFindAbstraction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 40
ccs 13
cts 13
cp 1
rs 10
c 1
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 45
    protected function findSomeType(
16
        SchemaItem $fromThis,
17
        DOMElement $node,
18
        $attributeName
19
    ) {
20 45
        return $this->findSomeTypeFromAttribute(
21 45
            $fromThis,
22 45
            $node,
23 45
            $node->getAttribute($attributeName)
24 45
        );
25
    }
26
27
    /**
28
     * @param string $attributeName
29
     *
30
     * @return SchemaItem
31
     */
32 45
    protected function findSomeTypeFromAttribute(
33
        SchemaItem $fromThis,
34
        DOMElement $node,
35
        $attributeName
36
    ) {
37
        /**
38
         * @var SchemaItem
39
         */
40 45
        $out = $this->findSomething(
41 45
            'findType',
42 45
            $fromThis->getSchema(),
43 45
            $node,
44
            $attributeName
45 45
        );
46
47 45
        return $out;
48
    }
49
}
50