TagUnion   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A parseMemberTypes() 0 12 4
A getAttributeMemberTypes() 0 3 1
A getMemberTypesChildren() 0 3 1
A hasMemberTypesAsChildren() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WsdlToPhp\WsdlHandler\Tag;
6
7
use WsdlToPhp\WsdlHandler\AbstractDocument;
8
9
class TagUnion extends Tag
10
{
11
    public const ATTRIBUTE_MEMBER_TYPES = 'memberTypes';
12
13 2
    public function getAttributeMemberTypes(): array
14
    {
15 2
        return $this->parseMemberTypes();
16
    }
17
18 4
    public function hasMemberTypesAsChildren(): bool
19
    {
20 4
        return 0 < count($this->getMemberTypesChildren());
21
    }
22
23 6
    public function getMemberTypesChildren(): array
24
    {
25 6
        return $this->getChildrenByName(AbstractDocument::TAG_SIMPLE_TYPE);
26
    }
27
28 2
    protected function parseMemberTypes(): array
29
    {
30 2
        $memberTypes = [];
31 2
        $value = $this->hasAttribute(self::ATTRIBUTE_MEMBER_TYPES) ? $this->getAttribute(self::ATTRIBUTE_MEMBER_TYPES)->getValue(true) : '';
32 2
        if (!empty($value)) {
33 2
            $values = explode(' ', $value);
34 2
            foreach ($values as $val) {
35 2
                $memberTypes[] = implode('', array_slice(explode(':', $val), -1, 1));
36
            }
37
        }
38
39 2
        return $memberTypes;
40
    }
41
}
42