Passed
Push — main ( b77906...b05fa5 )
by Bingo
02:54
created

AbstractChildElementAssumption::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 5
dl 0
loc 12
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Xml\Test;
4
5
use Xml\ModelInterface;
6
7
abstract class AbstractChildElementAssumption
8
{
9
    public $namespaceUri;
10
    public $childElementType;
11
    public $minOccurs;
12
    public $maxOccurs;
13
    private $model;
14
15
    public function __construct(
16
        ModelInterface $model,
17
        string $childElementType,
18
        int $minOccurs = null,
19
        int $maxOccurs = null,
20
        string $namespaceUri = null
21
    ) {
22
        $this->model = $model;
23
        $this->childElementType = $this->model->getType($childElementType);
24
        $this->minOccurs = $minOccurs ?? 0;
25
        $this->maxOccurs = $maxOccurs ?? -1;
26
        $this->namespaceUri = $namespaceUri ?? $this->getDefaultNamespace();
27
    }
28
29
    abstract public function getDefaultNamespace(): string;
30
}
31