Completed
Pull Request — master (#23)
by
unknown
02:14
created

StandardDocumentationReader::get()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 5

Importance

Changes 0
Metric Value
dl 0
loc 16
c 0
b 0
f 0
ccs 13
cts 13
cp 1
rs 8.8571
cc 5
eloc 9
nc 5
nop 1
crap 5
1
<?php
2
3
namespace GoetasWebservices\XML\XSDReader\Documentation;
4
5
use DOMElement;
6
7
class StandardDocumentationReader implements DocumentationReader
8
{
9 52
    public function get(DOMElement $node)
10
    {
11 52
        $doc = '';
12 52
        foreach ($node->childNodes as $childNode) {
13 52
            if ($childNode->localName == 'annotation') {
14 52
                foreach ($childNode->childNodes as $subChildNode) {
15 52
                    if ($subChildNode->localName == 'documentation') {
16 51
                        $doc .= ($subChildNode->nodeValue);
17 51
                    }
18 52
                }
19 52
            }
20 52
        }
21 52
        $doc = preg_replace('/[\t ]+/', ' ', $doc);
22
23 52
        return trim($doc);
24
    }
25
}
26