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

StandardDocumentationReader   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 19
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0
ccs 13
cts 13
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B get() 0 16 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