|
1
|
|
|
<?php |
|
2
|
|
|
namespace Yoanm\JsonRpcServerDoc\Domain\Model\Type; |
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* Class CollectionDoc |
|
6
|
|
|
*/ |
|
7
|
|
|
class CollectionDoc extends TypeDoc |
|
8
|
|
|
{ |
|
9
|
|
|
/*** Validation ***/ |
|
10
|
|
|
/** @var TypeDoc[] */ |
|
11
|
|
|
private $siblingList = []; |
|
12
|
|
|
/** @var null|int */ |
|
13
|
|
|
private $minItem = null; |
|
14
|
|
|
/** @var null|int */ |
|
15
|
|
|
private $maxItem = null; |
|
16
|
|
|
/** @var bool */ |
|
17
|
|
|
private $allowExtraSibling = false; |
|
18
|
|
|
/** @var bool */ |
|
19
|
|
|
private $allowMissingSibling = false; |
|
20
|
|
|
/** @var TypeDoc|null */ |
|
21
|
|
|
private $itemValidation = null; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @param TypeDoc $doc |
|
25
|
|
|
* |
|
26
|
|
|
* @return self |
|
27
|
|
|
*/ |
|
28
|
4 |
|
public function addSibling(TypeDoc $doc) : self |
|
29
|
|
|
{ |
|
30
|
4 |
|
$this->siblingList[] = $doc; |
|
31
|
|
|
|
|
32
|
4 |
|
return $this; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @param int $minItem |
|
37
|
|
|
* |
|
38
|
|
|
* @return self |
|
39
|
|
|
*/ |
|
40
|
4 |
|
public function setMinItem(int $minItem) : self |
|
41
|
|
|
{ |
|
42
|
4 |
|
$this->minItem = $minItem; |
|
43
|
|
|
|
|
44
|
4 |
|
return $this; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @param int $maxItem |
|
49
|
|
|
* |
|
50
|
|
|
* @return self |
|
51
|
|
|
*/ |
|
52
|
4 |
|
public function setMaxItem(int $maxItem) : self |
|
53
|
|
|
{ |
|
54
|
4 |
|
$this->maxItem = $maxItem; |
|
55
|
|
|
|
|
56
|
4 |
|
return $this; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @param bool $allowExtraSibling |
|
61
|
|
|
* |
|
62
|
|
|
* @return self |
|
63
|
|
|
*/ |
|
64
|
4 |
|
public function setAllowExtraSibling(bool $allowExtraSibling) : self |
|
65
|
|
|
{ |
|
66
|
4 |
|
$this->allowExtraSibling = $allowExtraSibling; |
|
67
|
|
|
|
|
68
|
4 |
|
return $this; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @param bool $allowMissingSibling |
|
73
|
|
|
* |
|
74
|
|
|
* @return self |
|
75
|
|
|
*/ |
|
76
|
4 |
|
public function setAllowMissingSibling(bool $allowMissingSibling) : self |
|
77
|
|
|
{ |
|
78
|
4 |
|
$this->allowMissingSibling = $allowMissingSibling; |
|
79
|
|
|
|
|
80
|
4 |
|
return $this; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @return null|int |
|
85
|
|
|
*/ |
|
86
|
10 |
|
public function getMinItem() : ?int |
|
87
|
|
|
{ |
|
88
|
10 |
|
return $this->minItem; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* @return null|int |
|
93
|
|
|
*/ |
|
94
|
10 |
|
public function getMaxItem() : ?int |
|
95
|
|
|
{ |
|
96
|
10 |
|
return $this->maxItem; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @return bool |
|
101
|
|
|
*/ |
|
102
|
10 |
|
public function isAllowExtraSibling() : bool |
|
103
|
|
|
{ |
|
104
|
10 |
|
return $this->allowExtraSibling; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* @return bool |
|
109
|
|
|
*/ |
|
110
|
10 |
|
public function isAllowMissingSibling() : bool |
|
111
|
|
|
{ |
|
112
|
10 |
|
return $this->allowMissingSibling; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* @return TypeDoc[] |
|
117
|
|
|
*/ |
|
118
|
10 |
|
public function getSiblingList() : array |
|
119
|
|
|
{ |
|
120
|
10 |
|
return $this->siblingList; |
|
121
|
|
|
} |
|
122
|
|
|
/** |
|
123
|
|
|
* @param TypeDoc $itemValidation |
|
124
|
|
|
* |
|
125
|
|
|
* @return self |
|
126
|
|
|
*/ |
|
127
|
1 |
|
public function setItemValidation(TypeDoc $itemValidation) : self |
|
128
|
|
|
{ |
|
129
|
1 |
|
$this->itemValidation = $itemValidation; |
|
130
|
|
|
|
|
131
|
1 |
|
return $this; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* @return TypeDoc|null |
|
136
|
|
|
*/ |
|
137
|
5 |
|
public function getItemValidation() : ?TypeDoc |
|
138
|
|
|
{ |
|
139
|
5 |
|
return $this->itemValidation; |
|
140
|
|
|
} |
|
141
|
|
|
} |
|
142
|
|
|
|