@@ -48,14 +48,14 @@ function unserialize($data, Unserializer|array|null $unserializer = null) : mixe
48
48
* Serializer interface, used to customize ion\serialize()'s behavior.
49
49
*/
50
50
interface Serializer {
51
- public function serialize (mixed $ data , \ ion \ Writer | \ ion \ Writer \ Options |array |null $ writer = null ) : mixed ;
51
+ public function serialize (mixed $ data , Writer |array |null $ writer = null ) : mixed ;
52
52
}
53
53
54
54
/**
55
55
* Unserializer interface, used to customize ion\unserialize()'s behavior.
56
56
*/
57
57
interface Unserializer {
58
- /** @param \ion\ Reader|string|resource $data */
58
+ /** @param Reader|string|resource $data */
59
59
public function unserialize ($ data ) : mixed ;
60
60
}
61
61
@@ -689,10 +689,14 @@ enum Format : string {
689
689
namespace ion \Reader ;
690
690
691
691
/**
692
- * Reader options .
692
+ * Base implementation of ION readers .
693
693
*/
694
- class Options {
694
+ abstract class Reader implements \ion \Reader {
695
+ /**
696
+ * @param string|resource $data The string or resource to read from.
697
+ */
695
698
public function __construct (
699
+ $ data ,
696
700
/**
697
701
* ION catalog to use for symbol lookup.
698
702
*/
@@ -730,16 +734,6 @@ public function __construct(
730
734
*/
731
735
public readonly bool $ skipCharacterValidation = false ,
732
736
) {}
733
- }
734
-
735
- /**
736
- * Base implementation of ION readers.
737
- */
738
- abstract class Reader implements \ion \Reader {
739
- /**
740
- * Reader options.
741
- */
742
- public readonly ?Options $ options ;
743
737
744
738
public function hasChildren () : bool {}
745
739
public function getChildren () : \ion \Reader {}
@@ -794,7 +788,7 @@ public function getValueLength() : int {}
794
788
*/
795
789
interface Buffer extends \ion \Reader {
796
790
/**
797
- * Get the buffer read from.
791
+ * Get the buffer being read from.
798
792
*
799
793
* @return string The buffer read from.
800
794
*/
@@ -806,7 +800,7 @@ public function getBuffer() : string;
806
800
*/
807
801
interface Stream extends \ion \Reader {
808
802
/**
809
- * Get the stream read from.
803
+ * Get the stream being read from.
810
804
*
811
805
* @return resource The stream read from.
812
806
*/
@@ -834,16 +828,6 @@ public function resetStreamWithLength($stream, int $length) : void;
834
828
* ION buffer reader.
835
829
*/
836
830
class Reader extends \ion \Reader \Reader implements \ion \Reader \Buffer {
837
- /**
838
- * Create a new string buffer reader.
839
- *
840
- * @param string $buffer The buffer to read from.
841
- * @param \ion\Reader\Options|array|null $options Reader options.
842
- */
843
- public function __construct (
844
- string $ buffer ,
845
- \ion \Reader \Options |array |null $ options = null ,
846
- ) {}
847
831
848
832
public function getBuffer () : string {}
849
833
}
@@ -854,16 +838,6 @@ public function getBuffer() : string {}
854
838
* ION stream reader.
855
839
*/
856
840
class Reader extends \ion \Reader \Reader implements \ion \Reader \Stream {
857
- /**
858
- * Create a new stream reader.
859
- *
860
- * @param resource $stream The stream to read from.
861
- * @param \ion\Reader\Options|array|null $options Reader options.
862
- */
863
- public function __construct (
864
- $ stream ,
865
- \ion \Reader \Options |array |null $ options = null ,
866
- ) {}
867
841
868
842
/**
869
843
* Get the stream read from.
@@ -881,11 +855,11 @@ public function resetStreamWithLength($stream, int $length) : void {}
881
855
namespace ion \Writer ;
882
856
883
857
/**
884
- * ION writer options .
858
+ * Base implementation of common functionality of ION writers .
885
859
*/
886
- class Options {
860
+ abstract class Writer implements \ ion \Writer {
887
861
/**
888
- * Create custom ION writer options .
862
+ * Create custom ION writer.
889
863
*/
890
864
public function __construct (
891
865
/**
@@ -937,12 +911,7 @@ public function __construct(
937
911
*/
938
912
public readonly int $ tempBufferSize = 0x4000 ,
939
913
) {}
940
- }
941
914
942
- /**
943
- * Base implementation of common functionality of ION writers.
944
- */
945
- abstract class Writer implements \ion \Writer {
946
915
public function writeNull () : void {}
947
916
public function writeTypedNull (\ion \Type $ type ) : void {}
948
917
public function writeBool (bool $ value ) : void {}
@@ -1005,17 +974,9 @@ public function getStream();
1005
974
namespace ion \Writer \Buffer ;
1006
975
1007
976
/**
1008
- * IO buffer writer.
977
+ * ION buffer writer.
1009
978
*/
1010
979
class Writer extends \ion \Writer \Writer implements \ion \Writer \Buffer {
1011
- /**
1012
- * Create a new buffer writer.
1013
- *
1014
- * @param \ion\Writer\Options|array|null $options Writer options.
1015
- */
1016
- public function __construct (
1017
- \ion \Writer \Options |array |null $ options = null ,
1018
- ) {}
1019
980
1020
981
public function getBuffer () : string {}
1021
982
public function resetBuffer () : void {}
@@ -1031,11 +992,57 @@ class Writer extends \ion\Writer\Writer implements \ion\Writer\Stream {
1031
992
* Create a new stream writer.
1032
993
*
1033
994
* @param resource $stream The stream to write to.
1034
- * @param \ion\Writer\Options|array|null $options Writer options.
1035
995
*/
1036
996
public function __construct (
1037
997
$ stream ,
1038
- \ion \Writer \Options |array |null $ options = null ,
998
+ /**
999
+ * ION catalog to use for symbol lookup.
1000
+ */
1001
+ public readonly ?\ion \Catalog $ catalog = null ,
1002
+ /**
1003
+ * Decimal context to use.
1004
+ */
1005
+ public readonly ?\ion \Decimal \Context $ decimalContext = null ,
1006
+ /**
1007
+ * Whether to output binary ION.
1008
+ */
1009
+ public readonly bool $ outputBinary = false ,
1010
+ /**
1011
+ * Whether to write doubles which fit in 32 bits as floats.
1012
+ */
1013
+ public readonly bool $ compactFloats = false ,
1014
+ /**
1015
+ * Whether to slash-escape all non ASCII bytes.
1016
+ */
1017
+ public readonly bool $ escapeNonAscii = false ,
1018
+ /**
1019
+ * Whether to produce pretty-printed output.
1020
+ */
1021
+ public readonly bool $ prettyPrint = false ,
1022
+ /**
1023
+ * Whether to indent with tabs, when pretty-printing.
1024
+ */
1025
+ public readonly bool $ indentTabs = true ,
1026
+ /**
1027
+ * The number of spaces to use for indentation instead of tabs, when pretty-printing.
1028
+ */
1029
+ public readonly int $ indentSize = 2 ,
1030
+ /**
1031
+ * Whether to immediately flush every value written.
1032
+ */
1033
+ public readonly bool $ flushEveryValue = false ,
1034
+ /**
1035
+ * Maximum depth of nested containers.
1036
+ */
1037
+ public readonly int $ maxContainerDepth = 10 ,
1038
+ /**
1039
+ * The maximum number of annotations allowed on a single value.
1040
+ */
1041
+ public readonly int $ maxAnnotations = 10 ,
1042
+ /**
1043
+ * Temporary buffer size.
1044
+ */
1045
+ public readonly int $ tempBufferSize = 0x4000 ,
1039
1046
) {}
1040
1047
/**
1041
1048
* @return resource
@@ -1066,7 +1073,7 @@ public function __construct(
1066
1073
public readonly ?string $ callCustomSerialize = null ,
1067
1074
) {}
1068
1075
1069
- public function serialize (mixed $ data , \ion \Writer |\ ion \ Writer \ Options | array |null $ writer = null ) : mixed {}
1076
+ public function serialize (mixed $ data , \ion \Writer |array |null $ writer = null ) : mixed {}
1070
1077
}
1071
1078
1072
1079
namespace ion \Unserializer ;
0 commit comments