Completed
Push — master ( 4b1c9c...cf6085 )
by SignpostMarv
04:26
created

StandardDocumentationReader   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
dl 0
loc 27
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
C get() 0 22 7
1
<?php
2
3
namespace GoetasWebservices\XML\XSDReader\Documentation;
4
5
use DOMElement;
6
7
class StandardDocumentationReader implements DocumentationReader
8
{
9
    /**
10
     * @return string
11
     */
12 52
    public function get(DOMElement $node)
13
    {
14 52
        $doc = '';
15
16
        /**
17
         * @var \DOMNode $childNode
18
         */
19 52
        foreach ($node->childNodes as $childNode) {
20 52
            if ($childNode instanceof DOMElement && $childNode->localName == 'annotation') {
21
                /**
22
                 * @var \DOMNode $subChildNode
23
                 */
24 52
                foreach ($childNode->childNodes as $subChildNode) {
25 52
                    if ($subChildNode instanceof DOMElement && $subChildNode->localName == 'documentation') {
26 51
                        $doc .= ($subChildNode->nodeValue);
27 51
                    }
28 52
                }
29 52
            }
30 52
        }
31 52
        $doc = preg_replace('/[\t ]+/', ' ', $doc);
32
33 52
        return trim($doc);
34
    }
35
}
36