initial ci
[awesomized/ext-ion] / ion.stub.php
1 <?php
2
3 /** @generate-class-entries */
4
5 namespace ion;
6 enum Type : int {
7 case Null = 0x000;
8 case Bool = 0x100;
9 case Int = 0x200;
10 case Float = 0x400;
11 case Decimal = 0x500;
12 case Timestamp = 0x600;
13 case Symbol = 0x700;
14 case String = 0x800;
15 case CLob = 0x900;
16 case BLob = 0xa00;
17 case AList = 0xb00;
18 case SExp = 0xc00;
19 case Struct = 0xd00;
20 case Datagram = 0xf00;
21
22 case EOF =-0x100;
23 case NONE =-0x200;
24 }
25
26 enum Annotation : string {
27 case PHP = "PHP";
28
29 case REFERENCE = "R";
30 case BACKREF = "r";
31
32 case OBJECT = "o";
33 case MAGIC_OBJ = "O";
34 case CUSTOM_OBJ = "C";
35 case SERIALIZABLE = "S";
36 case ENUM = "E";
37
38 case FIELD_NAME_INT = "i";
39 }
40
41 namespace ion\Symbol;
42 class ImportLocation {
43 public function __construct(
44 public readonly string $name,
45 public readonly int $location,
46 ) {}
47 }
48
49 namespace ion\Symbol;
50 enum System : string {
51 case Ion = '$ion';
52 case Ivm_1_0 = '$ion_1_0';
53 case IonSymbolTable = '$ion_symbol_table';
54 case Name = 'name';
55 case Version = 'version';
56 case Imports = 'imports';
57 case Symbols = 'symbols';
58 case MaxId = 'max_id';
59 case SharedSymbolTable = '$ion_shared_symbol_table';
60 }
61
62 namespace ion\Symbol\System;
63 enum SID : int {
64 case Ion = 1;
65 case Ivm_1_0 = 2;
66 case IonSymbolTable = 3;
67 case Name = 4;
68 case Version = 5;
69 case Imports = 6;
70 case Symbols = 7;
71 case MaxId = 8;
72 case SharedSymbolTable = 9;
73 }
74
75 namespace ion;
76 class Symbol {
77 public function __construct(
78 public readonly string $value,
79 public readonly int $sid = -1,
80 public readonly ?Symbol\ImportLocation $importLocation = null,
81 ) {}
82
83 public function equals(Symbol $symbol): bool { }
84 }
85
86 namespace ion\Symbol;
87 class Table {
88
89 }
90
91 namespace ion;
92 class Catalog {
93 }
94
95 namespace ion;
96 class Collection {
97
98 }
99
100 namespace ion;
101 class Decimal {
102 public function __construct(
103 string|int $number,
104 public readonly ?Decimal\Context $context = null,
105 ) {}
106
107 public function equals(Decimal $decimal) : bool {}
108 public function zero() : void {}
109
110 public function __toString() : string {}
111 /** @alias ion\Decimal::__toString */
112 public function toString() : string {}
113 public function toInt() : int {}
114 }
115
116 namespace ion\Decimal;
117 class Context {
118
119 }
120
121
122 namespace ion;
123 class Timestamp extends \DateTime {
124 public function __construct(
125 public readonly int $precision,
126 public readonly string $format = "c",
127 string $datetime = "now",
128 ?\DateTimeZone $timezone = null,
129 ) {}
130
131 public function __toString() : string {}
132 }
133
134
135 namespace ion;
136 interface Reader extends \RecursiveIterator {
137 public function getType() : Type;
138 public function hasAnnotations() : bool;
139 public function hasAnnotation(string $annotation) : bool;
140 public function isNull() : bool;
141 public function isInStruct() : bool;
142 public function getFieldName() : string;
143 public function getFieldNameSymbol() : Symbol;
144 public function getAnnotations() : array;
145 public function getAnnotationSymbols() : array;
146 public function countAnnotations() : int;
147 public function getAnnotation(int $index) : string;
148 public function getAnnotationSymbol(int $index) : Symbol;
149
150 public function readNull() : Type;
151 public function readBool() : bool;
152 public function readInt() : int|string;
153 public function readFloat() : float;
154 public function readDecimal() : Decimal;
155 public function readTimestamp() : Timestamp;
156 public function readSymbol() : Symbol;
157 public function readString() : string;
158 /** @param ref $string */
159 public function readStringPart(&$string, int $length = 0x1000) : bool;
160 public function readLob() : string;
161 /** @param ref $string */
162 public function readLobPart(&$string, int $length = 0x1000) : bool;
163
164 public function getPosition() : int;
165 public function getDepth() : int;
166
167 public function seek(int $offset, int $length = -1) : void;
168 /*
169 public function getSymbolTable() : SymbolTable;
170 public function setSymbolTable(SymbolTable $table) : void;
171 */
172 public function getValueOffset() : int;
173 public function getValueLength() : int;
174 }
175 namespace ion\Reader;
176 class Options {
177 public function __construct(
178 public readonly ?\ion\Catalog $catalog = null,
179 public readonly ?\ion\Decimal\Context $decimalContext = null,
180 public readonly ?\Closure $onContextChange = null,
181 public readonly bool $returnSystemValues = false,
182 public readonly int $newLine = 0xa,
183 public readonly int $maxContainerDepth = 10,
184 public readonly int $maxAnnotations = 10,
185 public readonly int $maxAnnotationBuffered = 512,
186 public readonly int $symbolThreshold = 4096,
187 public readonly int $userValueThreshold = 4096,
188 public readonly int $chunkThreshold = 4096,
189 public readonly int $allocationPageSize = 4096,
190 public readonly bool $skipCharacterValidation = false,
191 ) {}
192 }
193
194 namespace ion\Reader;
195 abstract class Reader implements \ion\Reader {
196 public readonly ?Options $options;
197
198 public function hasChildren() : bool {}
199 public function getChildren() : \ion\Reader {}
200
201 public function rewind() : void {}
202 public function next() : void {}
203 public function valid() : bool {}
204 public function key() : mixed {}
205 public function current() : mixed {}
206
207 public function getType() : \ion\Type {}
208 public function hasAnnotations() : bool {}
209 public function hasAnnotation(string $annotation) : bool {}
210 public function isNull() : bool {}
211 public function isInStruct() : bool {}
212 public function getFieldName() : string {}
213 public function getFieldNameSymbol() : \ion\Symbol {}
214 public function getAnnotations() : array {}
215 public function getAnnotationSymbols() : array {}
216 public function countAnnotations() : int {}
217 public function getAnnotation(int $index) : string {}
218 public function getAnnotationSymbol(int $index) : \ion\Symbol {}
219
220 public function readNull() : \ion\Type {}
221 public function readBool() : bool {}
222 public function readInt() : int|string {}
223 public function readFloat() : float {}
224 public function readDecimal() : \ion\Decimal {}
225 public function readTimestamp() : \ion\Timestamp {}
226 public function readSymbol() : \ion\Symbol {}
227 public function readString() : string {}
228 /** @param ref $string */
229 public function readStringPart(&$string, int $length = 0x1000) : bool {}
230 public function readLob() : string {}
231 /** @param ref $string */
232 public function readLobPart(&$string, int $length = 0x1000) : bool {}
233
234 public function getPosition() : int {}
235 public function getDepth() : int{}
236
237 public function seek(int $offset, int $length = -1) : void {}
238 /*
239 public function getSymbolTable() : SymbolTable {}
240 public function setSymbolTable(SymbolTable $table) : void {}
241 */
242 public function getValueOffset() : int {}
243 public function getValueLength() : int {}
244 }
245 namespace ion\Reader;
246 interface Buffer extends \ion\Reader {
247 public function getBuffer() : string;
248 }
249
250 namespace ion\Reader\Buffer;
251 class Reader extends \ion\Reader\Reader implements \ion\Reader\Buffer {
252 public function __construct(
253 string $buffer,
254 ?\ion\Reader\Options $options = null,
255 ) {}
256
257 public function getBuffer() : string {}
258 }
259
260 namespace ion\Reader;
261 interface Stream extends \ion\Reader {
262 /** @return resource */
263 public function getStream();
264 /** @param resource $stream */
265 public function resetStream($stream) : void;
266 /** @param resource $stream */
267 public function resetStreamWithLength($stream, int $position, int $length = -1) : void;
268 }
269
270 namespace ion\Reader\Stream;
271 class Reader extends \ion\Reader\Reader implements \ion\Reader\Stream {
272 /** @param resource $stream */
273 public function __construct(
274 $stream,
275 ?\ion\Reader\Options $options = null,
276 ) {
277 }
278 /** @return resource */
279 public function getStream() {}
280 /** @param resource $stream */
281 public function resetStream($stream) : void {}
282 /** @param resource $stream */
283 public function resetStreamWithLength($stream, int $position, int $length = -1) : void {}
284 }
285
286 namespace ion\Writer;
287 class Options {
288 public function __construct(
289 public readonly ?\ion\Catalog $catalog = null,
290 public readonly ?\ion\Decimal\Context $decimalContext = null,
291 ?\ion\Collection $encodingSymbolTable = null,
292 public readonly bool $outputBinary = false,
293 public readonly bool $compactFloats = false,
294 public readonly bool $escapeNonAscii = false,
295 public readonly bool $prettyPrint = false,
296 public readonly bool $indentTabs = true,
297 public readonly int $indentSize = 2,
298 public readonly bool $smallContainersInline = true,
299 public readonly bool $suppressSystemValues = false,
300 public readonly bool $flushEveryValue = false,
301 public readonly int $maxContainerDepth = 10,
302 public readonly int $maxAnnotations = 10,
303 public readonly int $tempBufferSize = 0x400,
304 public readonly int $allocationPageSize = 0x1000,
305 ) {}
306
307 // public function addSharedImports(\ion\Collection|\ion\Symbol\Table ...$imports) : void;
308 }
309
310 namespace ion;
311 interface Writer {
312 public function writeNull() : void;
313 public function writeTypedNull(Type $type) : void;
314 public function writeBool(bool $value) : void;
315 public function writeInt(int|string $value) : void;
316 public function writeFloat(float $value) : void;
317 public function writeDecimal(Decimal|string $value) : void;
318 public function writeTimestamp(Timestamp|string $value) : void;
319 public function writeSymbol(Symbol|string $value) : void;
320 public function writeString(string $value) : void;
321 public function writeCLob(string $value) : void;
322 public function writeBLob(string $value) : void;
323
324 public function startLob(Type $type) : void;
325 public function appendLob(string $data) : void;
326 public function finishLob() : void;
327
328 public function startContainer(Type $type) : void;
329 public function finishContainer() : void;
330
331 public function writeFieldName(string $name) : void;
332
333 public function writeAnnotation(Symbol|string ...$annotation) : void;
334
335 public function getDepth() : int;
336 public function flush() : int;
337 public function finish() : int;
338
339 public function writeOne(Reader $reader) : void;
340 public function writeAll(Reader $reader) : void;
341
342 // public function getCatalog() : Catalog;
343 // public function setCatalog(Catalog $catalog) : void;
344
345 // public function getSymbolTable() : Symbol\Table;
346 // puvlic function setSymbolTable(Symbol\Table $table) : void;
347 }
348
349 namespace ion\Writer;
350 abstract class Writer implements \ion\Writer {
351 public function writeNull() : void {}
352 public function writeTypedNull(\ion\Type $type) : void {}
353 public function writeBool(bool $value) : void {}
354 public function writeInt(int|string $value) : void {}
355 public function writeFloat(float $value) : void {}
356 public function writeDecimal(\ion\Decimal|string $value) : void {}
357 public function writeTimestamp(\ion\Timestamp|string $value) : void {}
358 public function writeSymbol(\ion\Symbol|string $value) : void {}
359 public function writeString(string $value) : void {}
360 public function writeCLob(string $value) : void {}
361 public function writeBLob(string $value) : void {}
362
363 public function startLob(\ion\Type $type) : void {}
364 public function appendLob(string $data) : void {}
365 public function finishLob() : void {}
366
367 public function startContainer(\ion\Type $type) : void {}
368 public function finishContainer() : void {}
369
370 public function writeFieldName(string $name) : void {}
371
372 public function writeAnnotation(\ion\Symbol|string ...$annotation) : void {}
373
374 public function getDepth() : int {}
375 public function flush() : int {}
376 public function finish() : int {}
377
378 public function writeOne(\ion\Reader $reader) : void {}
379 public function writeAll(\ion\Reader $reader) : void {}
380 }
381
382 namespace ion\Writer;
383 interface Buffer extends \ion\Writer {
384 public function getBuffer() : string;
385 }
386
387 namespace ion\Writer\Buffer;
388 class Writer extends \ion\Writer\Writer implements \ion\Writer\Buffer {
389 /** @param ref $buffer */
390 public function __construct(
391 ?string &$buffer,
392 ?\ion\Writer\Options $options = null,
393 ) {}
394
395 /**
396 * @return string a _copy_ of $buffer passed to the constructor
397 */
398 public function getBuffer() : string {}
399 }
400
401 namespace ion\Writer;
402 interface Stream extends \ion\Writer {
403 /** @return resource */
404 public function getStream();
405 }
406
407 namespace ion\Writer\Stream;
408 class Writer extends \ion\Writer\Writer implements \ion\Writer\Stream {
409 /** @param resource $stream */
410 public function __construct(
411 $stream,
412 ?\ion\Writer\Options $options = null,
413 ) {}
414 /** @return resource */
415 public function getStream() {}
416 }
417
418 namespace ion\PHP;
419 class Serializer {
420 public function __construct(
421 public readonly \ion\Writer $writer,
422 public readonly bool $callMagicSerialize = true,
423 public readonly ?string $callCustomSerialize = null,
424 ) {}
425 public function __invoke(mixed $data) : void {}
426 protected function serialize(mixed $data) : void {}
427 }
428
429 namespace ion\PHP;
430 class Unserializer {
431 public function __construct(
432 public readonly \ion\Reader $reader,
433 public readonly bool $callMagicUnserialize = true,
434 public readonly ?string $callCustomUnserialize = null,
435 ){}
436 public function __invoke() : mixed {}
437 protected function unserialize() : mixed {}
438 }
439
440 namespace ion;
441 function serialize(mixed $data, Writer\Options $options = null) : string {}
442 function unserialize(mixed $serialized, Reader\Options $options = null) : mixed {}
443
444
445
446