TagDocumentation   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 30
ccs 12
cts 12
cp 1
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getContent() 0 3 1
A getSuitableParent() 0 10 3
A getSuitableParentTags() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WsdlToPhp\WsdlHandler\Tag;
6
7
use WsdlToPhp\DomHandler\AbstractNodeHandler;
8
use WsdlToPhp\WsdlHandler\AbstractDocument;
9
10
class TagDocumentation extends Tag
11
{
12 2
    public function getContent(): string
13
    {
14 2
        return $this->getNodeValue();
15
    }
16
17
    /**
18
     * Finds parent node of this documentation node without taking care of the name attribute for enumeration.
19
     * This case is managed first because enumerations are contained by elements and
20
     * the method could climb to its parent without stopping on the enumeration tag.
21
     * Indeed, depending on the node, it may contain or not the attribute named "name" so we have to split each case.
22
     */
23 4
    public function getSuitableParent(bool $checkName = true, array $additionalTags = [], int $maxDeep = self::MAX_DEEP, bool $strict = false): ?AbstractNodeHandler
24
    {
25 4
        if (!$strict) {
26 4
            $enumerationTag = $this->getStrictParent(AbstractDocument::TAG_ENUMERATION);
27 4
            if ($enumerationTag instanceof TagEnumeration) {
28 2
                return $enumerationTag;
29
            }
30
        }
31
32 4
        return parent::getSuitableParent($checkName, $additionalTags, $maxDeep, $strict);
33
    }
34
35 2
    public function getSuitableParentTags(array $additionalTags = []): array
36
    {
37 2
        return parent::getSuitableParentTags(array_merge($additionalTags, [
38 2
            AbstractDocument::TAG_OPERATION,
39 2
            AbstractDocument::TAG_ATTRIBUTE_GROUP,
40 2
        ]));
41
    }
42
}
43