1 | <?php |
||
27 | class Zone |
||
28 | { |
||
29 | use RecordsIterateTrait; |
||
30 | |||
31 | /** |
||
32 | * @var String |
||
33 | */ |
||
34 | private $origin; |
||
35 | /** |
||
36 | * @var Node[] $nodes |
||
37 | */ |
||
38 | private $nodes = []; |
||
39 | /** |
||
40 | * @var ErrorsStore |
||
41 | */ |
||
42 | private $errorsStore; |
||
43 | |||
44 | /** |
||
45 | * @param $origin |
||
46 | */ |
||
47 | 1 | public function __construct(string $origin) |
|
52 | |||
53 | /** |
||
54 | * @param string $origin |
||
55 | * @param string $plainData |
||
56 | * @return Zone |
||
57 | */ |
||
58 | 1 | public static function fromString(string $origin, string $plainData) : Zone |
|
62 | |||
63 | /** |
||
64 | * @param string $origin |
||
65 | * @param array $arrayData |
||
66 | * @return Zone |
||
67 | */ |
||
68 | public static function fromArray(string $origin, array $arrayData) : Zone |
||
72 | |||
73 | /** |
||
74 | * @return string |
||
75 | */ |
||
76 | 1 | public function __toString() : string |
|
86 | |||
87 | /** |
||
88 | * Sort zone by node names and record types |
||
89 | */ |
||
90 | 1 | public function sort() |
|
109 | |||
110 | /** |
||
111 | * @return Node[] |
||
112 | */ |
||
113 | 1 | public function iterateNodes() |
|
119 | |||
120 | /** |
||
121 | * @param eRecordType|null $type |
||
122 | * @return Record[] |
||
123 | */ |
||
124 | 1 | public function iterateRecords(eRecordType $type = NULL) |
|
132 | |||
133 | /** |
||
134 | * @return array |
||
135 | */ |
||
136 | 1 | public function toArray() : array |
|
145 | |||
146 | /** |
||
147 | * @return array |
||
148 | */ |
||
149 | public function getNodeNames() : array |
||
153 | |||
154 | /** |
||
155 | * @param $name |
||
156 | * @return Node |
||
157 | */ |
||
158 | 1 | public function getNode(string $name) : Node |
|
168 | |||
169 | /** |
||
170 | * Check is node by given name already exists |
||
171 | * |
||
172 | * @param $name |
||
173 | * @return bool |
||
174 | */ |
||
175 | 1 | public function isNodeExist($name) : bool |
|
179 | |||
180 | /** |
||
181 | * @param eRecordType|NULL $type |
||
182 | */ |
||
183 | public function removeRecords(eRecordType $type = NULL) |
||
191 | |||
192 | /** |
||
193 | * @return bool |
||
194 | */ |
||
195 | public function isEmptyZone() : bool |
||
205 | |||
206 | /** |
||
207 | * Full validate zone via build in validators |
||
208 | * |
||
209 | * @return bool |
||
210 | */ |
||
211 | 1 | public function validate() : bool |
|
231 | |||
232 | /** |
||
233 | * @return ErrorsStore |
||
234 | */ |
||
235 | 1 | public function getErrorsStore() |
|
239 | |||
240 | /** |
||
241 | * @return String |
||
242 | */ |
||
243 | 1 | public function getOrigin() : string |
|
247 | } |