SimpleType::addUnion()   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 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GoetasWebservices\XML\XSDReader\Schema\Type;
6
7
use GoetasWebservices\XML\XSDReader\Schema\Inheritance\Restriction;
8
9
class SimpleType extends Type
10
{
11
    /**
12
     * @var Restriction|null
13
     */
14
    protected $restriction;
15
16
    /**
17
     * @var SimpleType[]
18
     */
19
    protected $unions = [];
20
21
    /**
22
     * @var SimpleType|null
23
     */
24
    protected $list;
25
26 15
    public function getRestriction(): ?Restriction
27
    {
28 15
        return $this->restriction;
29
    }
30
31 74
    public function setRestriction(Restriction $restriction): void
32
    {
33 74
        $this->restriction = $restriction;
34 74
    }
35
36 74
    public function addUnion(self $type): void
37
    {
38 74
        $this->unions[] = $type;
39 74
    }
40
41
    /**
42
     * @return SimpleType[]
43
     */
44 2
    public function getUnions(): array
45
    {
46 2
        return $this->unions;
47
    }
48
49
    public function getList(): ?self
50
    {
51
        return $this->list;
52
    }
53
54 74
    public function setList(self $list): void
55
    {
56 74
        $this->list = $list;
57 74
    }
58
}
59