TagRestriction::hasAttributeBase()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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