Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions reference/mongodb/bson/document/frombson.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new <classname>MongoDB\BSON\Document</classname> instance.
</para>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<simplelist>
Expand Down
14 changes: 13 additions & 1 deletion reference/mongodb/bson/document/fromjson.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,23 @@
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new <classname>MongoDB\BSON\Document</classname> instance.
</para>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<simplelist>
&mongodb.throws.argumentparsing;
<member>Throws <classname>MongoDB\Driver\Exception\UnexpectedValueException</classname> if <parameter>json</parameter> is not a valid document.</member>
<member>
Throws
<classname>MongoDB\Driver\Exception\UnexpectedValueException</classname> if
the JSON value cannot be converted to a BSON document (e.g. due to a syntax
error).
</member>
</simplelist>
</refsect1>

Expand Down
7 changes: 7 additions & 0 deletions reference/mongodb/bson/document/fromphp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new <classname>MongoDB\BSON\Document</classname> instance.
</para>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<simplelist>
Expand Down
11 changes: 10 additions & 1 deletion reference/mongodb/bson/document/tocanonicalextendedjson.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@
&no.function.parameters;
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a string containing the
<link xlink:href="&url.mongodb.specs.extendedjson;#canonical-extended-json-example">Canonical Extended JSON</link>
representation of the BSON document.
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
Expand All @@ -42,7 +51,7 @@ $documents = [
[ 'string' => 'foo' ],
[ 'int32' => 123 ],
[ 'int64' => 4294967295 ],
[ 'double' => 1.0, ],
[ 'double' => 1.0 ],
[ 'nan' => NAN ],
[ 'pos_inf' => INF ],
[ 'neg_inf' => -INF ],
Expand Down
11 changes: 10 additions & 1 deletion reference/mongodb/bson/document/torelaxedextendedjson.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
&no.function.parameters;
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a string containing the
<link xlink:href="&url.mongodb.specs.extendedjson;#relaxed-extended-json-example">Relaxed Extended JSON</link>
representation of the BSON document.
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
Expand All @@ -41,7 +50,7 @@ $documents = [
[ 'string' => 'foo' ],
[ 'int32' => 123 ],
[ 'int64' => 4294967295 ],
[ 'double' => 1.0, ],
[ 'double' => 1.0 ],
[ 'nan' => NAN ],
[ 'pos_inf' => INF ],
[ 'neg_inf' => -INF ],
Expand Down
126 changes: 126 additions & 0 deletions reference/mongodb/bson/packedarray/fromjson.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mongodb-bson-packedarray.fromjson" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoDB\BSON\PackedArray::fromJSON</refname>
<refpurpose>Construct a new BSON array instance from a JSON string</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier> <modifier>static</modifier> <modifier>public</modifier> <type>MongoDB\BSON\PackedArray</type><methodname>MongoDB\BSON\PackedArray::fromJSON</methodname>
<methodparam><type>string</type><parameter>json</parameter></methodparam>
</methodsynopsis>
<para>
Converts an
<link xlink:href="&url.mongodb.docs.extendedjson;">extended JSON</link>
string to its BSON representation.
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>json</parameter> (<type>string</type>)</term>
<listitem>
<para>
JSON value to be converted.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new <classname>MongoDB\BSON\PackedArray</classname> instance.
</para>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<simplelist>
&mongodb.throws.argumentparsing;
<member>
Throws
<classname>MongoDB\Driver\Exception\UnexpectedValueException</classname> if
the JSON value cannot be converted to a BSON array (e.g. due to a syntax
error).
</member>
</simplelist>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
<title><methodname>MongoDB\BSON\PackedArray::fromJSON</methodname> example</title>
<programlisting role="php">
<![CDATA[
<?php
$json = '[ "foo", { "$numberInt" : "123" }, { "$numberLong" : "4294967295" }, { "$oid" : "56315a7c6118fd1b920270b1" } ]';
$packedArray = MongoDB\BSON\PackedArray::fromJSON($json);
var_dump($packedArray);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
object(MongoDB\BSON\PackedArray)#1 (2) {
["data"]=>
string(68) "MQAAAAIwAAQAAABmb28AEDEAewAAABIyAP////8AAAAABzMAVjFafGEY/RuSAnCxAA=="
["value"]=>
array(4) {
[0]=>
string(3) "foo"
[1]=>
int(123)
[2]=>
int(4294967295)
[3]=>
object(MongoDB\BSON\ObjectId)#2 (1) {
["oid"]=>
string(24) "56315a7c6118fd1b920270b1"
}
}
}
]]>
</screen>
</example>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>MongoDB\BSON\PackedArray::fromPHP</methodname></member>
<member><link xlink:href="&url.mongodb.docs.extendedjson;">MongoDB Extended JSON</link></member>
<member><link xlink:href="&url.mongodb.docs.bson;">BSON Types</link></member>
</simplelist>
</refsect1>

</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
7 changes: 7 additions & 0 deletions reference/mongodb/bson/packedarray/fromphp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new <classname>MongoDB\BSON\PackedArray</classname> instance.
</para>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<simplelist>
Expand Down
100 changes: 100 additions & 0 deletions reference/mongodb/bson/packedarray/tocanonicalextendedjson.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mongodb-bson-packedarray.tocanonicalextendedjson" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoDB\BSON\PackedArray::toCanonicalExtendedJSON</refname>
<refpurpose>Returns the Canonical Extended JSON representation of the BSON array</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier> <modifier>public</modifier> <type>string</type><methodname>MongoDB\BSON\PackedArray::toCanonicalExtendedJSON</methodname>
<void/>
</methodsynopsis>
<para>
Converts the BSON array to its
<link xlink:href="&url.mongodb.specs.extendedjson;#canonical-extended-json-example">Canonical Extended JSON</link>
representation. The canonical format prefers type fidelity at the expense of
concise output and is most suited for producing output that can be converted
back to BSON without any loss of type information (e.g. numeric types will
remain differentiated).
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a string containing the
<link xlink:href="&url.mongodb.specs.extendedjson;#canonical-extended-json-example">Canonical Extended JSON</link>
representation of the BSON array.
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
<title><methodname>MongoDB\BSON\PackedArray::toCanonicalExtendedJSON</methodname> example</title>
<programlisting role="php">
<![CDATA[
<?php
$array = [
'foo',
123,
4294967295,
new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1'),
];
$packedArray = MongoDB\BSON\PackedArray::fromPHP($array);
echo $packedArray->toCanonicalExtendedJSON(), "\n";
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
[ "foo", { "$numberInt" : "123" }, { "$numberLong" : "4294967295" }, { "$oid" : "56315a7c6118fd1b920270b1" } ]
]]>
</screen>
</example>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>MongoDB\BSON\PackedArray::fromJSON</methodname></member>
<member><methodname>MongoDB\BSON\PackedArray::toRelaxedExtendedJSON</methodname></member>
<member><function>MongoDB\BSON\toCanonicalExtendedJSON</function></member>
<member><link xlink:href="&url.mongodb.specs.extendedjson;">Extended JSON Specification</link></member>
<member><link xlink:href="&url.mongodb.docs.bson;">BSON Types</link></member>
</simplelist>
</refsect1>

</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
Loading