From 477056db110fc9f60d1a8e185df72b8020309317 Mon Sep 17 00:00:00 2001
From: Michael Wallner
Last modified:
- 2022-03-03 08:45:59 UTC
+ 2022-04-01 16:15:03 UTC
diff --git a/docs/v0.1/ion.html b/docs/v0.1/ion.html
index b80a5c6..81f3884 100644
--- a/docs/v0.1/ion.html
+++ b/docs/v0.1/ion.html
@@ -136,7 +136,7 @@
-
@@ -202,7 +202,7 @@
-
@@ -299,8 +299,8 @@ docker build -t php-ion
docker run --rm php-ion -r 'echo ion\seriali
instances of the following PHP classes cannot be cloned:
This extension provides a stub file four your editor's auto-completion.
Download the Stub file:
@@ -309,7 +309,7 @@ instances of the following PHP classes cannot be cloned:Quoting the official Ion documentation:
Amazon Ion is a richly-typed, self-describing, hierarchical data serialization format offering interchangeable binary and text representations. The text format (a superset of JSON) is easy to read and author, supporting rapid prototyping.
The binary representation is efficient to store, transmit, and skip-scan parse.
The rich type system provides unambiguous semantics for longterm preservation of data which can survive multiple generations of software evolution.
Ion was built to address rapid development, decoupling, and efficiency challenges faced every day while engineering large-scale, service-oriented architectures.
Quoting the official Ion documentation:
Amazon Ion is a richly-typed, self-describing, hierarchical data serialization format offering interchangeable binary and text representations. The text format (a superset of JSON) is easy to read and author, supporting rapid prototyping.
The binary representation is efficient to store, transmit, and skip-scan parse.
The rich type system provides unambiguous semantics for longterm preservation of data which can survive multiple generations of software evolution.
Ion was built to address rapid development, decoupling, and efficiency challenges faced every day while engineering large-scale, service-oriented architectures.
<?=
ion\serialize([
  "key" => "value",
  "more" => [
    "data" => 123
  ]
]);
?>
@@ -94,7 +102,7 @@
[
  'key' => 'value',
  'more' => [
    'data' => 123,
  ],
]
Ion supports multiple sequences of documents within a single stream; consider the following:
-<?=
var_representation(
  ion\unserialize('
    {"key":"value","more":{"data":123}}
    {"key":"value","more":{"data":456}}
  ', new ion\Unserializer\PHP(multiSequence: true)
  )
);
?>
+<?=
var_representation(
  ion\unserialize('
    {"key":"value","more":{"data":123}}
    {"key":"value","more":{"data":456}}
  ', new ion\Unserializer\Unserializer(multiSequence: true)
  )
);
?>
diff --git a/docs/v0.1/ion/: Tutorial/:4. Special Datatypes.html b/docs/v0.1/ion/: Tutorial/:4. Special Datatypes.html
index 59524ca..b2b0966 100644
--- a/docs/v0.1/ion/: Tutorial/:4. Special Datatypes.html
+++ b/docs/v0.1/ion/: Tutorial/:4. Special Datatypes.html
@@ -110,10 +110,10 @@ The interface <?php
 Â
class custom {
  private array $data;
  function init(array $data) : void {
    $this->data = $data;
  }
  function export() : array {
    return $this->data;
  }
}
$custom = new custom;
$custom->init(["foo"Â =>Â "bar"]);
echo $srlzd = ion\serialize($custom);
/*
    c::custom::{data:p::custom::{foo:"bar"}}
   Â
*/
?>
The above is actually the result of serializing a standard class backed PHP object, because we didn't implement any serialization primitives and did neither specify a custom method to call. So let's just do that:
-<?php
 Â
$srlzr = new ion\Serializer\PHP(callCustomSerialize: "export");
echo $srlzd = ion\serialize($custom, $srlzr);
/*
    C::custom::{foo:"bar"}
*/
?>
+<?php
 Â
$srlzr = new ion\Serializer\Serializer(callCustomSerialize: "export");
echo $srlzd = ion\serialize($custom, $srlzr);
/*
    C::custom::{foo:"bar"}
*/
?>
Note how this output compares to the output of the standard magic serializable object.
Unserialization works as used to, except sepcifying thwe custom unserialization method to call:
-<?php
 Â
$unsrlzr = new ion\Unserializer\PHP(callCustomUnserialize: "init");
var_dump(ion\unserialize($srlzd, $unsrlzr));
/*
    object(custom)#10 (1) {
    ["data":"custom":private]=>
    array(1) {
      ["foo"]=>
      string(3) "bar"
    }
  }
*/
?>
+<?php
 Â
$unsrlzr = new ion\Unserializer\Unserializer(callCustomUnserialize: "init");
var_dump(ion\unserialize($srlzd, $unsrlzr));
/*
    object(custom)#10 (1) {
    ["data":"custom":private]=>
    array(1) {
      ["foo"]=>
      string(3) "bar"
    }
  }
*/
?>
An S-expression (or symbolic expression) is much like a list in that itâs an ordered collection of values. However, the notation aligns with Lisp syntax to connote use of application semantics like function calls or programming-language statements. As such, correct interpretation requires a higher-level context other than the raw Ion parser and data model.
In the text format, S-expressions are bounded by parentheses. S-expressions also allow unquoted operator symbols (in addition to the unquoted identifier symbols allowed everywhere), so commas are interpreted as values rather than element separators.
diff --git a/docs/v0.1/ion/: Tutorial/:5. Symbols, Tables and Catalogs.html b/docs/v0.1/ion/: Tutorial/:5. Symbols, Tables and Catalogs.html
index d2c8151..24c51c8 100644
--- a/docs/v0.1/ion/: Tutorial/:5. Symbols, Tables and Catalogs.html
+++ b/docs/v0.1/ion/: Tutorial/:5. Symbols, Tables and Catalogs.html
@@ -92,7 +92,7 @@
<?php
var_dump(ion\unserialize($writer->getBuffer(), [
  "multiSequence" => true,
]));
/*
array(3)Â {
  [0]=>
  array(3) {
    ["$10"]=>
    int(1)
    ["$11"]=>
    string(3) "foo"
    ["$12"]=>
    bool(false)
  }
  [1]=>
  array(3) {
    ["$10"]=>
    int(2)
    ["$11"]=>
    string(3) "bar"
    ["$12"]=>
    bool(true)
  }
  [2]=>
  array(3) {
    ["$10"]=>
    int(3)
    ["$11"]=>
    string(3) "baz"
    ["$12"]=>
    bool(true)
  }
}
*/
?>
When unserializing with known symbols, the symbol IDs will be resolved when using the catatalog with the appropriate symbol tables:
-<?php
 Â
var_dump(ion\unserialize($writer->getBuffer(), [
  "multiSequence" => true,
  "readerOptions" => [
    "catalog" => $catalog
  ]
]));
/*
  array(3) {
    [0]=>
    array(3) {
      ["id"]=>
      int(1)
      ["type"]=>
      string(3) "foo"
      ["state"]=>
      bool(false)
    }
    [1]=>
    array(3) {
      ["id"]=>
      int(2)
      ["type"]=>
      string(3) "bar"
      ["state"]=>
      bool(true)
    }
    [2]=>
    array(3) {
      ["id"]=>
      int(3)
      ["type"]=>
      string(3) "baz"
      ["state"]=>
      bool(true)
    }
  }
*/
?>
+<?php
$reader = new \ion\Reader\Buffer\Reader($writer->getBuffer(), [
    "catalog" => $catalog
]);
$unser = new ion\Unserializer\Unserializer(multiSequence: true);
var_dump($unser->unserialize($reader));
/*
  array(3) {
    [0]=>
    array(3) {
      ["id"]=>
      int(1)
      ["type"]=>
      string(3) "foo"
      ["state"]=>
      bool(false)
    }
    [1]=>
    array(3) {
      ["id"]=>
      int(2)
      ["type"]=>
      string(3) "bar"
      ["state"]=>
      bool(true)
    }
    [2]=>
    array(3) {
      ["id"]=>
      int(3)
      ["type"]=>
      string(3) "baz"
      ["state"]=>
      bool(true)
    }
  }
*/
?>
void ion\Reader\Buffer\Reader::__construct(string $buffer, [?ion\Reader\Options $options = NULL])Create a new string buffer reader.
void ion\Reader\Buffer\Reader::__construct(string $buffer, [ion\Reader\Options|array|null $options = NULL])Create a new string buffer reader.
string $buffer#NULLarray|null $options# = NULLCreate a new stream reader.
-void ion\Reader\Stream\Reader::__construct(resource $stream, [?ion\Reader\Options $options = NULL])
void ion\Reader\Stream\Reader::__construct(resource $stream, [ion\Reader\Options|array|null $options = NULL])
void ion\Reader\Stream\Reader::__construct(resource $stream, [?ion\Reader\Options $options = NULL])Create a new stream reader.
void ion\Reader\Stream\Reader::__construct(resource $stream, [ion\Reader\Options|array|null $options = NULL])Create a new stream reader.
resource $stream#NULLarray|null $options# = NULLstring ion\Serializer::serialize(mixed $data)
mixed ion\Serializer::serialize(mixed $data, [ion\Writer|ion\Writer\Options|array|null $writer = NULL])
Specialization of the serializer for PHP.
+Serializer implementation
-class ion\Serializer\PHP implements ion\Serializer
+class ion\Serializer\Serializer implements ion\Serializer
None.
array|null $writerOptions# = NULLNULLbool $multiSequence# = falseCreate a new PHP ION serializer.
-void ion\Serializer\PHP::__construct([ion\Writer\Options|array|null $writerOptions = NULL, [bool $multiSequence = false, [bool $callMagicSerialize = true, [?string $callCustomSerialize = NULL]]]])
void ion\Serializer\PHP::__construct([?ion\Writer\Options $writerOptions = NULL, [bool $multiSequence = false, [bool $callMagicSerialize = true, [?string $callCustomSerialize = NULL]]]])
void ion\Serializer\PHP::__construct([ion\Writer\Options|array|null $writerOptions = NULL, [bool $multiSequence = false, [bool $callMagicSerialize = true, [?string $callCustomSerialize = NULL]]]])Create a new PHP ION serializer.
void ion\Serializer\PHP::__construct([?ion\Writer\Options $writerOptions = NULL, [bool $multiSequence = false, [bool $callMagicSerialize = true, [?string $callCustomSerialize = NULL]]]])Create a new PHP ION serializer.
array|null $writerOptions# = NULLNULLbool $multiSequence# = falsearray as multiple ION sequences.Serializer implementation
None.
bool $multiSequence# = falsearray as multiple ION sequences.bool $callMagicSerialize# = truestring $callCustomSerialize# = NULLCreate a new ION serializer.
+ +void ion\Serializer\Serializer::__construct([bool $multiSequence = false, [bool $callMagicSerialize = true, [?string $callCustomSerialize = NULL]]])
void ion\Serializer\Serializer::__construct([bool $multiSequence = false, [bool $callMagicSerialize = true, [?string $callCustomSerialize = NULL]]])Create a new ION serializer.
bool $multiSequence# = falsearray as multiple ION sequences.bool $callMagicSerialize# = truestring $callCustomSerialize# = NULLstring ion\Serializer::serialize(mixed $data)mixed ion\Serializer::serialize(mixed $data, [ion\Writer|ion\Writer\Options|array|null $writer = NULL])mixed $data#
array|null $writer# = NULL
+mixed ion\Unserializer::unserialize(string|resource $data)
mixed ion\Unserializer::unserialize(\ion\Reader|string|resource $data)
Specialization of the unserializer for PHP.
+Unserializer implementation
-class ion\Unserializer\PHP implements ion\Unserializer
+class ion\Unserializer\Unserializer implements ion\Unserializer
None.
array|null $readerOptions# = NULLNULLbool $multiSequence# = falseCreate a new ION PHP unserializer.
-void ion\Unserializer\PHP::__construct([ion\Reader\Options|array|null $readerOptions = NULL, [bool $multiSequence = false, [bool $callMagicUnserialize = true, [?string $callCustomUnserialize = NULL]]]])
void ion\Unserializer\PHP::__construct([?ion\Reader\Options $readerOptions = NULL, [bool $multiSequence = false, [bool $callMagicUnserialize = true, [?string $callCustomUnserialize = NULL]]]])
void ion\Unserializer\PHP::__construct([ion\Reader\Options|array|null $readerOptions = NULL, [bool $multiSequence = false, [bool $callMagicUnserialize = true, [?string $callCustomUnserialize = NULL]]]])Create a new ION PHP unserializer.
void ion\Unserializer\PHP::__construct([?ion\Reader\Options $readerOptions = NULL, [bool $multiSequence = false, [bool $callMagicUnserialize = true, [?string $callCustomUnserialize = NULL]]]])Create a new ION PHP unserializer.
array|null $readerOptions# = NULLNULLbool $multiSequence# = falseUnserializer implementation
None.
bool $multiSequence# = falsebool $callMagicUnserialize# = truestring $callCustomUnserialize# = NULLCreate a new ION unserializer.
+ +void ion\Unserializer\Unserializer::__construct([bool $multiSequence = false, [bool $callMagicUnserialize = true, [?string $callCustomUnserialize = NULL]]])
void ion\Unserializer\Unserializer::__construct([bool $multiSequence = false, [bool $callMagicUnserialize = true, [?string $callCustomUnserialize = NULL]]])Create a new ION unserializer.
bool $multiSequence# = falsebool $callMagicUnserialize# = truestring $callCustomUnserialize# = NULLmixed ion\Unserializer::unserialize(string|resource $data)mixed ion\Unserializer::unserialize(\ion\Reader|string|resource $data)Create a new buffer writer.
-void ion\Writer\Buffer\Writer::__construct([?ion\Writer\Options $options = NULL])
void ion\Writer\Buffer\Writer::__construct([ion\Writer\Options|array|null $options = NULL])
void ion\Writer\Buffer\Writer::__construct([?ion\Writer\Options $options = NULL])Create a new buffer writer.
void ion\Writer\Buffer\Writer::__construct([ion\Writer\Options|array|null $options = NULL])Create a new buffer writer.
NULLarray|null $options# = NULLCreate a new stream writer.
-void ion\Writer\Stream\Writer::__construct(resource $stream, [?ion\Writer\Options $options = NULL])
void ion\Writer\Stream\Writer::__construct(resource $stream, [ion\Writer\Options|array|null $options = NULL])
void ion\Writer\Stream\Writer::__construct(resource $stream, [?ion\Writer\Options $options = NULL])Create a new stream writer.
void ion\Writer\Stream\Writer::__construct(resource $stream, [ion\Writer\Options|array|null $options = NULL])Create a new stream writer.
resource $stream#NULLarray|null $options# = NULLmixed $data#array|null $serializer# = NULLstring|resource $data#string buffer or stream.array|null $unserializer# = NULL
Create a new
-stringbuffer reader.
+voidion\Reader\Buffer\Reader::__construct(string$buffer, [?ion\Reader\Options $options =NULL])
diff --git a/docs/v0.1/ion/Reader/Buffer/Reader/__construct.html b/docs/v0.1/ion/Reader/Buffer/Reader/__construct.html index f92561b..b009675 100644 --- a/docs/v0.1/ion/Reader/Buffer/Reader/__construct.html +++ b/docs/v0.1/ion/Reader/Buffer/Reader/__construct.html @@ -77,12 +77,12 @@voidion\Reader\Buffer\Reader::__construct(string$buffer, [ion\Reader\Options|array|null$options =NULL])