TagRestriction   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getEnumerations() 0 3 1
A hasAttributeBase() 0 3 1
A isEnumeration() 0 3 1
A hasUnionParent() 0 5 1
A getAttributeBase() 0 3 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WsdlToPhp\WsdlHandler\Tag;
6
7
use WsdlToPhp\WsdlHandler\AbstractDocument;
8
9
class TagRestriction extends Tag
10
{
11
    public const ATTRIBUTE_BASE = 'base';
12
13 2
    public function isEnumeration(): bool
14
    {
15 2
        return 0 < count($this->getEnumerations());
16
    }
17
18 2
    public function getEnumerations(): array
19
    {
20 2
        return $this->getChildrenByName(AbstractDocument::TAG_ENUMERATION);
21
    }
22
23 4
    public function getAttributeBase(): string
24
    {
25 4
        return $this->hasAttributeBase() ? $this->getAttribute(self::ATTRIBUTE_BASE)->getValue() : '';
26
    }
27
28 6
    public function hasAttributeBase(): bool
29
    {
30 6
        return $this->hasAttribute(self::ATTRIBUTE_BASE);
31
    }
32
33 2
    public function hasUnionParent(): bool
34
    {
35 2
        return $this->getSuitableParent(false, [
36 2
            AbstractDocument::TAG_UNION,
37 2
        ], self::MAX_DEEP, true) instanceof TagUnion;
38
    }
39
}
40