4 * Amazon ION serialization format.
6 * @link https://github.com/awesomized/ext-ion
8 * @see https://github.com/amzn/ion-c amzn/ion-c
9 * @see https://amzn.github.io/ion-docs/ Amazon ION spec
11 * @generate-class-entries static
12 * @generate-function-entries static
18 * Serialize a PHP value as ION data.
20 * Serializes supported PHP values with the optionally provided \ion\Serializer:
28 * * object (incl. \Serializable, and classes implementing magic and custom __serialize)
30 * @param mixed $data PHP value(s).
31 * @param Serializer|null $serializer Custom serializer.
32 * @return string serialized ION data
33 * @throws \ion\Exception
35 function serialize(mixed $data, ?Serializer
$serializer = null) : string {}
38 * Unserialize ION data (stream) as PHP value(s).
40 * @param string|resource $data Serialized ION data, either as string buffer or stream.
41 * @return mixed unserialized PHP values
42 * @throws \ion\Exception
44 function unserialize($data, ?Unserializer
$unserializer = null) : mixed {}
47 * Serializer interface, used to customize ion\serialize()'s behavior.
49 interface Serializer
{
50 public function serialize(mixed $data) : string;
54 * Unserializer interface, used to customize ion\unserialize()'s behavior.
56 interface Unserializer
{
57 /** @param string|resource $data */
58 public function unserialize($data) : mixed;
62 * Base exception for the ION extension.
64 class Exception
extends \Exception
{
70 * The following special PHP classes are provided for some data types:
82 case Timestamp
= 0x600;
90 case Datagram
= 0xf00;
97 * @see https://amzn.github.io/ion-docs/docs/spec.html#symbol ION spec's symbol definition
98 * @see https://amzn.github.io/ion-docs/guides/symbols-guide.html ION spec's symbol guide
102 * Create an ION symbol.
104 public function __construct(
106 * The symbol's text representation.
108 public readonly ?
string $value = null,
110 * The symbols ID, referencing its location within a shared symbol table.
112 public readonly
int $sid = -1,
114 * The import location referencing a shared symbol table.
116 public readonly ?Symbol\ImportLocation
$importLocation = null,
120 * Compare two symbols for equality.
122 * Two symbols are considered equal, if either:
123 * * both are the same object or NULL
124 * * both values are NULL (unknown text), and both $importLocations match
125 * * both values match, regardless of $sid and $importLocation
127 * @param Symbol $symbol
128 * @return bool whether the two Symbols equal
130 public function equals(Symbol
$symbol): bool {}
131 public function __toString() : string {}
132 /** @alias ion\Symbol::__toString */
133 public function toString() : string {}
137 * The Catalog holds a collection of ion\Symbol\Table instances queried from ion\Reader and ion\Writer instances.
139 * @see https://amzn.github.io/ion-docs/docs/symbols.html#the-catalog the ION spec's symbol guide chapter on catalog.
141 class Catalog
implements \Countable
{
142 /** Internal cache. */
143 private array $symbolTables = [];
145 /** Create a new Catalog. */
146 public function __construct() {}
148 /** Count how many symbol tables the catalog holds. */
149 public function count() : int {}
152 * Add a shared symbol table to the catalog.
154 * @param Symbol\Table $table The new table to add.
156 public function add(Symbol\Table
$table) : void
{}
159 * Remove a shared symbol table from the catalog.
161 * @param Symbol\Table|string $table The symbol table to renmove.
162 * @return bool Success.
164 public function remove(Symbol\Table|
string $table) : bool {}
167 * Find a shared symbol table within the catalog.
169 * @param string $name The name of the symbol table.
170 * @param int $version The version the symbol table should match.
171 * @return Symbol\Table|null The symbol table found, if any.
173 public function find(string $name, int $version = 0) : ?Symbol\Table
{}
176 * Find a "best match" for a shared symbol table within the catalog.
178 * @param string $name The name of the symbol table,
179 * @param int $version The minimum version of the symbol table.
180 * @return Symbol\Table|null The symbol table found, if any.
182 public function findBest(string $name, int $version = 0) : ?Symbol\Table
{}
189 * @see https://amzn.github.io/ion-docs/docs/spec.html#blob the ION spec's BLob definition
190 * @see https://amzn.github.io/ion-docs/docs/spec.html#clob the ION sepc's CLob definition
194 * Create an ION large object.
196 public function __construct(
198 * The value of the large object.
200 public readonly
string $value,
202 * The type (CLob/BLob).
204 public readonly Type
$type = Type
::CLob
,
209 * An arbitrary precision fixed point decimal.
211 * @see ion\Decimal\Context
212 * @see https://amzn.github.io/ion-docs/docs/decimal.html the ION spec's decimal docs
216 * Create a new fixed point decimal.
218 public function __construct(
220 * The decimal number.
222 public readonly
string|
int $number,
224 * The decimal context.
226 public readonly ?Decimal\Context
$context = null,
230 * Check two decimals for equality.
232 * @param Decimal $decimal The decimal to compare to.
233 * @return bool Whether both decimals equal.
235 public function equals(Decimal
$decimal) : bool {}
238 * Check whether the decimal is actually a big integer.
239 * @return bool Whether the decimal is actually an integer.
241 public function isInt() : bool {}
243 public function __toString() : string {}
245 * Get the string representation of the decimal.
246 * @alias ion\Decimal::__toString
248 public function toString() : string {}
251 * Get the integer represention of the decimal.
252 * @throws \ion\Exception If the decimal is actually not an integer.
254 public function toInt() : int {}
259 * @see https://amzn.github.io/ion-docs/docs/spec.html#timestamp the ION spec's timestamp definition
260 * @see https://php.net/date PHP's date documentation
262 class Timestamp
extends \DateTime
{
264 * The timestamp's precision. See ion\Timestamp\Precision.
266 public readonly
int $precision;
268 * The timestamp's format. See ion\Timestamp\Format.
270 public readonly
string $format;
273 * Create a new ION timestamp.
275 * @param Timestamp\Precision|int $precision The timestamp's precision.
276 * @param Timestamp\Format|string|null $format The timestamp's format.
277 * @param string|null $datetime The timestamp's value.
278 * @param \DateTimeZone|null $timezone The timestamp's timezone.
280 public function __construct(
281 Timestamp\Precision|
int $precision,
282 Timestamp\Format|
string|
null $format = null,
283 ?
string $datetime = null,
284 ?\DateTimeZone
$timezone = null,
287 public function __toString() : string {}
293 interface Reader
extends \RecursiveIterator
{
294 public function getType() : Type
;
295 public function hasAnnotations() : bool;
296 public function hasAnnotation(string $annotation) : bool;
297 public function isNull() : bool;
298 public function isInStruct() : bool;
299 public function getFieldName() : string;
300 public function getFieldNameSymbol() : Symbol
;
301 public function getAnnotations() : array;
302 public function getAnnotationSymbols() : array;
303 public function countAnnotations() : int;
304 public function getAnnotation(int $index) : string;
305 public function getAnnotationSymbol(int $index) : Symbol
;
307 public function readNull() : Type
;
308 public function readBool() : bool;
309 public function readInt() : int|
string;
310 public function readFloat() : float;
311 public function readDecimal() : Decimal
;
312 public function readTimestamp() : Timestamp
;
313 public function readSymbol() : Symbol
;
314 public function readString() : string;
315 /** @param ref $string */
316 public function readStringPart(&$string, int $length = 0x1000) : bool;
317 public function readLob() : string;
318 /** @param ref $string */
319 public function readLobPart(&$string, int $length = 0x1000) : bool;
321 public function getPosition() : int;
322 public function getDepth() : int;
324 public function seek(int $offset, int $length = -1) : void
;
326 public function getSymbolTable() : SymbolTable;
327 public function setSymbolTable(SymbolTable $table) : void;
329 public function getValueOffset() : int;
330 public function getValueLength() : int;
337 public function writeNull() : void
;
338 public function writeTypedNull(Type
$type) : void
;
339 public function writeBool(bool $value) : void
;
340 public function writeInt(int|
string $value) : void
;
341 public function writeFloat(float $value) : void
;
342 public function writeDecimal(Decimal|
string $value) : void
;
343 public function writeTimestamp(Timestamp|
string $value) : void
;
344 public function writeSymbol(Symbol|
string $value) : void
;
345 public function writeString(string $value) : void
;
346 public function writeCLob(string $value) : void
;
347 public function writeBLob(string $value) : void
;
349 public function startLob(Type
$type) : void
;
350 public function appendLob(string $data) : void
;
351 public function finishLob() : void
;
353 public function startContainer(Type
$type) : void
;
354 public function finishContainer() : void
;
356 public function writeFieldName(string $name) : void
;
358 public function writeAnnotation(Symbol|
string ...$annotation) : void
;
360 public function getDepth() : int;
361 public function flush() : int;
362 public function finish() : int;
364 // public function writeOne(Reader $reader) : void;
365 // public function writeAll(Reader $reader) : void;
367 // public function getCatalog() : Catalog;
368 // public function setCatalog(Catalog $catalog) : void;
370 // public function getSymbolTable() : Symbol\Table;
371 // puvlic function setSymbolTable(Symbol\Table $table) : void;
374 namespace ion\Symbol
;
377 * The import location (referring to a shared table) of a symbol.
379 class ImportLocation
{
381 * Create a new import location.
383 public function __construct(
385 * The name of the shared symbol table.
387 public readonly
string $name,
389 * The location (sid) of the symbol within the table.
391 public readonly
int $location,
396 * Base interface of built-in shared symbol tables.
400 * @return \ion\Symbol Instance of the symbol.
402 public function toSymbol() : \ion\Symbol
;
405 * @return int The symbol id.
407 public function toSID() : int;
410 * @return string The symbol's textual representation.
412 public function toString() : string;
416 * Base interface of an ION symbol table.
420 * Get the maximum symbol ID within the symbol table.
421 * @return int The maximum symbol ID.
423 public function getMaxId() : int;
426 * Add a symbol to the table.
428 * @param \ion\Symbol|string $symbol The symbol (value) to add.
429 * @return int The symbol ID.
431 public function add(\ion\Symbol|
string $symbol) : int;
434 * Find a symbol within the symbol table, including imports.
436 * @param string|int $id The ID or text of the symbol to find.
437 * @return \ion\Symbol|null The symbol found, if any.
439 public function find(string|
int $id) : ?\ion\Symbol
;
442 * Find a symbol within **only this** symbol table, ignoring imports.
444 * @param string|int $id The ID or text of the symbol to find.
445 * @return \ion\Symbol|null The symbol found, if any.
447 public function findLocal(string|
int $id) : ?\ion\Symbol
;
451 * The built-in ION system symbols.
453 enum System
: string implements \ion\Symbol\Enum
{
455 case Ivm_1_0
= '$ion_1_0';
456 case IonSymbolTable
= '$ion_symbol_table';
458 case Version
= 'version';
459 case Imports
= 'imports';
460 case Symbols
= 'symbols';
461 case MaxId
= 'max_id';
462 case SharedSymbolTable
= '$ion_shared_symbol_table';
464 /** @alias ion\Symbol\Enum::toSymbol */
465 public function toSymbol() : \ion\Symbol
{}
466 /** @alias ion\Symbol\Enum::toSID */
467 public function toSID() : int {}
468 /** @alias ion\Symbol\Enum::toString */
469 public function toString() : string {}
472 * Get the built-in ION system shared symbol table.
474 * @return Table\Shared The system symbol table.
476 public static function asTable() : Table\Shared
{}
480 * The built-in PHP symbols.
482 enum PHP
: string implements \ion\Symbol\Enum
{
484 case Reference
= 'R';
488 case ClassObject
= 'c';
489 case MagicObject
= 'O';
490 case CustomObject
= 'C';
492 case Serializable
= 'S';
494 /** @alias ion\Symbol\Enum::toSymbol */
495 public function toSymbol() : \ion\Symbol
{}
496 /** @alias ion\Symbol\Enum::toSID */
497 public function toSID() : int {}
498 /** @alias ion\Symbol\Enum::toString */
499 public function toString() : string {}
502 * Get the built-in PHP shared symbol table.
504 * @return Table\Shared The builtin PHP shared symbol table.
506 public static function asTable() : Table\Shared
{}
509 namespace ion\Symbol\Table
;
512 * A local symbol table.
514 * @see https://amzn.github.io/ion-docs/guides/symbols-guide.html the ION spec's symbol guide
515 * @see https://amzn.github.io/ion-docs/guides/cookbook.html#using-a-local-symbol-table the ION doc's cookbook
517 class Local
implements \ion\Symbol\Table
{
518 /** Internal cache. */
519 private array $imports = [];
520 /** Internal cache. */
521 private array $symbols = [];
524 * Create a local symbol table.
526 public function __construct() {}
529 * Import a symbol table.
531 * @param \ion\Symbol\Table $table The symbol table to import.
534 public function import(\ion\Symbol\Table
$table) : void
{}
536 /** @alias ion\Symbol\Table::getMaxId */
537 public function getMaxId() : int {}
539 /** @alias ion\Symbol\Table::add */
540 public function add(\ion\Symbol|
string $symbol) : int {}
541 /** @alias ion\Symbol\Table::find */
542 public function find(string|
int $id) : ?\ion\Symbol
{}
543 /** @alias ion\Symbol\Table::findLocal */
544 public function findLocal(string|
int $id) : ?\ion\Symbol
{}
548 * A shared symbol table.
550 * @see https://amzn.github.io/ion-docs/guides/symbols-guide.html the ION spec's symbol guide
551 * @see https://amzn.github.io/ion-docs/guides/cookbook.html#using-a-shared-symbol-table the ION doc's cookbook
553 class Shared
implements \ion\Symbol\Table
{
555 * Create a shared symbol table.
557 public function __construct(
559 * The name of the shared symbol table.
561 public readonly
string $name,
563 * The version of the shared symbol table.
565 public readonly
int $version = 1,
567 * Predefined list of symbols as array of strings.
569 ?
array $symbols = null,
572 /** Internal cache. */
573 private array $symbols = [];
575 /** @alias ion\Symbol\Table::getMaxId */
576 public function getMaxId() : int {}
578 /** @alias ion\Symbol\Table::add */
579 public function add(\ion\Symbol|
string $symbol) : int {}
580 /** @alias ion\Symbol\Table::find */
581 public function find(string|
int $id) : ?\ion\Symbol
{}
582 /** @alias ion\Symbol\Table::findLocal */
583 public function findLocal(string|
int $id) : ?\ion\Symbol
{}
586 namespace ion\Decimal
;
589 * An ion\Decimal's context.
593 * Create a new decimal context.
595 public function __construct(
599 public readonly
int $digits,
603 public readonly
int $eMax,
607 public readonly
int $eMin,
611 public readonly Context\Rounding|
int $round,
615 public readonly
bool $clamp,
619 * Create a context suitable for 32bit decimals.
621 public static function Dec32() : Context
{}
624 * Create a context suitable for 64bit decimals.
626 public static function Dec64() : Context
{}
629 * Create a context suitable for 128bit decimals.
631 public static function Dec128() : Context
{}
634 * Create a context with maximum settings.
635 * @param Context\Rounding|int $round Rounding mode.
637 public static function DecMax(Context\Rounding|
int $round = Context\Rounding
::HalfEven
) : Context
{}
640 namespace ion\Decimal\Context
;
645 enum Rounding
: int {
656 namespace ion\Timestamp
;
659 * Timestamp precision.
661 enum Precision
: int {
663 case Month
= 0x1|
0x2;
664 case Day
= 0x1|
0x2|
0x4;
665 case Min
= 0x1|
0x2|
0x4|
0x10;
666 case Sec
= 0x1|
0x2|
0x4|
0x10|
0x20;
667 case Frac
= 0x1|
0x2|
0x4|
0x10|
0x20|
0x40;
668 case MinTZ
= 0x1|
0x2|
0x4|
0x10|
0x80;
669 case SecTZ
= 0x1|
0x2|
0x4|
0x10|
0x20|
0x80;
670 case FracTZ
= 0x1|
0x2|
0x4|
0x10|
0x20|
0x40|
0x80;
676 enum Format
: string {
678 case Month
= "Y-m\T";
679 case Day
= "Y-m-d\T";
680 case Min
= "Y-m-d\TH:i";
681 case Sec
= "Y-m-d\TH:i:s";
682 case Frac
= "Y-m-d\TH:i:s.v";
683 case MinTZ
= "Y-m-d\TH:iP";
684 case SecTZ
= "Y-m-d\TH:i:sP";
685 case FracTZ
= "Y-m-d\TH:i:s.vP";
688 namespace ion\Reader
;
694 public function __construct(
696 * ION catalog to use for symbol lookup.
698 public readonly ?\ion\Catalog
$catalog = null,
700 * Decimal context to use.
702 public readonly ?\ion\Decimal\Context
$decimalContext = null,
704 * Callback as function(\ion\Reader):void called upon local symbol table context change.
706 public readonly ?\Closure
$onContextChange = null,
708 * Whether to return otherwise hidden system values.
710 public readonly
bool $returnSystemValues = false,
712 * The maximum depth of nested containers.
714 public readonly
int $maxContainerDepth = 10,
716 * The maximum number of annotations allowed on a single value.
718 public readonly
int $maxAnnotations = 10,
720 * The maximum number of bytes of all annotations on a single value.
722 public readonly
int $annotationBufferSize = 0x4000,
724 * The maximum number of bytes of a symbol/value/chunk.
726 public readonly
int $tempBufferSize = 0x4000,
728 * Whether to skip UTF-8 validation.
730 public readonly
bool $skipCharacterValidation = false,
735 * Base implementation of ION readers.
737 abstract class Reader
implements \ion\Reader
{
741 public readonly ?Options
$options;
743 public function hasChildren() : bool {}
744 public function getChildren() : \ion\Reader
{}
746 public function rewind() : void
{}
747 public function next() : void
{}
748 public function valid() : bool {}
749 public function key() : mixed {}
750 public function current() : mixed {}
752 public function getType() : \ion\Type
{}
753 public function hasAnnotations() : bool {}
754 public function hasAnnotation(string $annotation) : bool {}
755 public function isNull() : bool {}
756 public function isInStruct() : bool {}
757 public function getFieldName() : string {}
758 public function getFieldNameSymbol() : \ion\Symbol
{}
759 public function getAnnotations() : array {}
760 public function getAnnotationSymbols() : array {}
761 public function countAnnotations() : int {}
762 public function getAnnotation(int $index) : string {}
763 public function getAnnotationSymbol(int $index) : \ion\Symbol
{}
765 public function readNull() : \ion\Type
{}
766 public function readBool() : bool {}
767 public function readInt() : int|
string {}
768 public function readFloat() : float {}
769 public function readDecimal() : \ion\Decimal
{}
770 public function readTimestamp() : \ion\Timestamp
{}
771 public function readSymbol() : \ion\Symbol
{}
772 public function readString() : string {}
773 /** @param ref $string */
774 public function readStringPart(&$string, int $length = 0x1000) : bool {}
775 public function readLob() : string {}
776 /** @param ref $string */
777 public function readLobPart(&$string, int $length = 0x1000) : bool {}
779 public function getPosition() : int {}
780 public function getDepth() : int{}
782 public function seek(int $offset, int $length = -1) : void
{}
784 public function getSymbolTable() : SymbolTable {}
785 public function setSymbolTable(SymbolTable $table) : void {}
787 public function getValueOffset() : int {}
788 public function getValueLength() : int {}
792 * ION string buffer reader API.
794 interface Buffer
extends \ion\Reader
{
796 * Get the buffer read from.
798 * @return string The buffer read from.
800 public function getBuffer() : string;
804 * ION stream reader API.
806 interface Stream
extends \ion\Reader
{
808 * Get the stream read from.
810 * @return resource The stream read from.
812 public function getStream();
815 * Reset the stream read from.
817 * @param resource $stream The new stream to from.
819 public function resetStream($stream) : void
;
822 * Reset the stream read from, limiting length to read.
824 * @param resource $stream The stream to read from.
825 * @param int $length The maximum length to read from $stream.
827 public function resetStreamWithLength($stream, int $length) : void
;
830 namespace ion\Reader\Buffer
;
835 class Reader
extends \ion\Reader\Reader
implements \ion\Reader\Buffer
{
837 * Create a new string buffer reader.
839 * @param string $buffer The buffer to read from.
840 * @param \ion\Reader\Options|null $options Reader options.
842 public function __construct(
844 ?\ion\Reader\Options
$options = null,
847 public function getBuffer() : string {}
850 namespace ion\Reader\Stream
;
855 class Reader
extends \ion\Reader\Reader
implements \ion\Reader\Stream
{
857 * Create a new stream reader.
859 * @param resource $stream The stream to read from.
860 * @param \ion\Reader\Options|null $options Reader options.
862 public function __construct(
864 ?\ion\Reader\Options
$options = null,
868 * Get the stream read from.
870 * @return resource The stream read from.
872 public function getStream() {}
874 /** @param resource $stream */
875 public function resetStream($stream) : void
{}
876 /** @param resource $stream */
877 public function resetStreamWithLength($stream, int $length) : void
{}
880 namespace ion\Writer
;
883 * ION writer options.
887 * Create custom ION writer options.
889 public function __construct(
891 * ION catalog to use for symbol lookup.
893 public readonly ?\ion\Catalog
$catalog = null,
895 * Decimal context to use.
897 public readonly ?\ion\Decimal\Context
$decimalContext = null,
899 * Whether to output binary ION.
901 public readonly
bool $outputBinary = false,
903 * Whether to write doubles which fit in 32 bits as floats.
905 public readonly
bool $compactFloats = false,
907 * Whether to slash-escape all non ASCII bytes.
909 public readonly
bool $escapeNonAscii = false,
911 * Whether to produce pretty-printed output.
913 public readonly
bool $prettyPrint = false,
915 * Whether to indent with tabs, when pretty-printing.
917 public readonly
bool $indentTabs = true,
919 * The number of spaces to use for indentation instead of tabs, when pretty-printing.
921 public readonly
int $indentSize = 2,
923 * Whether to immediately flush every value written.
925 public readonly
bool $flushEveryValue = false,
927 * Maximum depth of nested containers.
929 public readonly
int $maxContainerDepth = 10,
931 * The maximum number of annotations allowed on a single value.
933 public readonly
int $maxAnnotations = 10,
935 * Temporary buffer size.
937 public readonly
int $tempBufferSize = 0x4000,
942 * Base implementation of common functionality of ION writers.
944 abstract class Writer
implements \ion\Writer
{
945 public function writeNull() : void
{}
946 public function writeTypedNull(\ion\Type
$type) : void
{}
947 public function writeBool(bool $value) : void
{}
948 public function writeInt(int|
string $value) : void
{}
949 public function writeFloat(float $value) : void
{}
950 public function writeDecimal(\ion\Decimal|
string $value) : void
{}
951 public function writeTimestamp(\ion\Timestamp|
string $value) : void
{}
952 public function writeSymbol(\ion\Symbol|
string $value) : void
{}
953 public function writeString(string $value) : void
{}
954 public function writeCLob(string $value) : void
{}
955 public function writeBLob(string $value) : void
{}
957 public function startLob(\ion\Type
$type) : void
{}
958 public function appendLob(string $data) : void
{}
959 public function finishLob() : void
{}
961 public function startContainer(\ion\Type
$type) : void
{}
962 public function finishContainer() : void
{}
964 public function writeFieldName(string $name) : void
{}
966 public function writeAnnotation(\ion\Symbol|
string ...$annotation) : void
{}
968 public function getDepth() : int {}
969 public function flush() : int {}
970 public function finish() : int {}
972 // public function writeOne(\ion\Reader $reader) : void {}
973 // public function writeAll(\ion\Reader $reader) : void {}
977 * ION buffer writer API.
979 interface Buffer
extends \ion\Writer
{
981 * Get the buffer written to.
983 * @reeturn string The buffer written so far.
985 public function getBuffer() : string;
988 * Reset the buffer written to.
990 public function resetBuffer() : void
;
994 * ION stream writer API.
996 interface Stream
extends \ion\Writer
{
998 * Get the stream being written to.
1001 public function getStream();
1004 namespace ion\Writer\Buffer
;
1009 class Writer
extends \ion\Writer\Writer
implements \ion\Writer\Buffer
{
1011 * Create a new buffer writer.
1013 * @param \ion\Writer\Options|null $options Writer options.
1015 public function __construct(
1016 ?\ion\Writer\Options
$options = null,
1019 public function getBuffer() : string {}
1020 public function resetBuffer() : void
{}
1023 namespace ion\Writer\Stream
;
1026 * ION stream writer.
1028 class Writer
extends \ion\Writer\Writer
implements \ion\Writer\Stream
{
1030 * Create a new stream writer.
1032 * @param resource $stream The stream to write to.
1033 * @param \ion\Writer\Options|null $options Writer options.
1035 public function __construct(
1037 ?\ion\Writer\Options
$options = null,
1042 public function getStream() {}
1045 namespace ion\Serializer
;
1048 * Specialization of the serializer for PHP.
1050 class PHP
implements \ion\Serializer
{
1052 * Create a new PHP ION serializer.
1054 public function __construct(
1058 public readonly ?\ion\Writer\Options
$writerOptions = null,
1060 * Whether to write the top level array as multiple ION sequences.
1062 public readonly
bool $multiSequence = false,
1064 * Whether to call magic __serialize() methods on objects to serialize.
1066 public readonly
bool $callMagicSerialize = true,
1068 * Whether and which custom serialize method to call on objects to serialize.
1070 public readonly ?
string $callCustomSerialize = null,
1073 public function serialize(mixed $data) : string {}
1076 namespace ion\Unserializer
;
1079 * Specialization of the unserializer for PHP.
1081 class PHP
implements \ion\Unserializer
{
1083 * Create a new ION PHP unserializer.
1085 public function __construct(
1089 public readonly ?\ion\Reader\Options
$readerOptions = null,
1091 * Whether to continue reading multiple ION sequences after the first one.
1093 public readonly
bool $multiSequence = false,
1095 * Whether to call magic __unserialize() methods on objects to unserialize.
1097 public readonly
bool $callMagicUnserialize = true,
1099 * Whether and which custom unserialize method to call on objects to unserialize.
1101 public readonly ?
string $callCustomUnserialize = null,
1104 /** @param string|resource $data */
1105 public function unserialize($data) : mixed {}