mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Initial commit
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@270047 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
8dd650004e
commit
7dbea99281
3 changed files with 283 additions and 0 deletions
120
language/predefined/serializable.xml
Normal file
120
language/predefined/serializable.xml
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
|
||||
<phpdoc:classref xml:id="class.serializable" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<title>The Serializable class</title>
|
||||
<titleabbrev>Serializable</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
|
||||
<!-- {{{ Serializable intro -->
|
||||
<section xml:id="serializable.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
Interface for customized serializing.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Classes that implement this interface no longer support
|
||||
<link linkend="language.oop5.magic.sleep">__sleep()</link> and
|
||||
<link linkend="language.oop5.magic.sleep">__wakeup()</link>. The method serialized is
|
||||
called whenever an instance needs to be serialized. This does not invoke __destruct()
|
||||
or has any other side effect unless programmed inside the method. When the data is
|
||||
unserialized the class is known and the appropriate unserialize() method is called as
|
||||
a constructor instead of calling __construct(). If you need to execute the standard
|
||||
constructor you may do so in the method
|
||||
</para>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
||||
<section xml:id="serializable.synopsis">
|
||||
&reftitle.classsynopsis;
|
||||
|
||||
<!-- {{{ Synopsis -->
|
||||
<classsynopsis>
|
||||
<ooclass><classname>Serializable</classname></ooclass>
|
||||
|
||||
<!-- {{{ Class synopsis -->
|
||||
<classsynopsisinfo>
|
||||
<ooclass>
|
||||
<classname>Serializable</classname>
|
||||
</ooclass>
|
||||
</classsynopsisinfo>
|
||||
<!-- }}} -->
|
||||
|
||||
<classsynopsisinfo role="comment">Methods</classsynopsisinfo>
|
||||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.serializable')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
|
||||
</classsynopsis>
|
||||
<!-- }}} -->
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="serializable.examples">
|
||||
<example xml:id="serializable.example.basic"><!-- {{{ -->
|
||||
<title>Basic usage</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
class obj implements Serializable {
|
||||
private $data;
|
||||
public function __construct() {
|
||||
$this->data = "My private data";
|
||||
}
|
||||
public function serialize() {
|
||||
return serialize($this->data);
|
||||
}
|
||||
public function unserialize($data) {
|
||||
$this->data = unserialize($data);
|
||||
}
|
||||
public function getData() {
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new obj;
|
||||
$ser = serialize($obj);
|
||||
|
||||
$newobj = unserialize($ser);
|
||||
|
||||
var_dump($newobj->getData());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
string(15) "My private data"
|
||||
]]>
|
||||
</screen>
|
||||
</example><!-- }}} -->
|
||||
</section>
|
||||
|
||||
|
||||
</partintro>
|
||||
|
||||
&language.predefined.serializable.serialize;
|
||||
&language.predefined.serializable.unserialize;
|
||||
|
||||
</phpdoc:classref>
|
||||
|
||||
<!-- 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:"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
|
||||
-->
|
80
language/predefined/serializable/serialize.xml
Normal file
80
language/predefined/serializable/serialize.xml
Normal file
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
|
||||
<refentry xml:id="serializable.serialize" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Serializable::serialize</refname>
|
||||
<refpurpose>String representation of object</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>abstract</modifier> <modifier>public</modifier> <type>string</type><methodname>Serializable::serialize</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Should return the string representation of the object.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
This method acts as the
|
||||
<link linkend="language.oop5.decon.destructor">destructor</link> of the object. The
|
||||
<function>__destruct</function> method will <emphasis>not</emphasis> be called after this
|
||||
method.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the string representation of the object or &null;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
Throws <classname>Exception</classname> when returning other types then strings and
|
||||
&null;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="language.oop5.magic.sleep">__sleep()</link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</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:"../../../../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
|
||||
-->
|
83
language/predefined/serializable/unserialize.xml
Normal file
83
language/predefined/serializable/unserialize.xml
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
|
||||
<refentry xml:id="serializable.unserialize" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Serializable::unserialize</refname>
|
||||
<refpurpose>Constructs the object</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>abstract</modifier> <modifier>public</modifier> <type>mixed</type><methodname>Serializable::unserialize</methodname>
|
||||
<methodparam><type>string</type><parameter>serialized</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Called during unserialization of the object.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
This method acts as the
|
||||
<link linkend="language.oop5.decon.constructor">constructor</link> of the object. The
|
||||
<function>__construct</function> method will <emphasis>not</emphasis> be called after this
|
||||
method.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>serialized</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The string representation of the object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the original value unserialized.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="language.oop5.magic.sleep">__wakeup()</link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</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:"../../../../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…
Reference in a new issue