From 7dbea99281a456e5acb1ba5112b729347dc51c4d Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Fri, 28 Nov 2008 21:54:24 +0000 Subject: [PATCH] Initial commit git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@270047 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/predefined/serializable.xml | 120 ++++++++++++++++++ .../predefined/serializable/serialize.xml | 80 ++++++++++++ .../predefined/serializable/unserialize.xml | 83 ++++++++++++ 3 files changed, 283 insertions(+) create mode 100644 language/predefined/serializable.xml create mode 100644 language/predefined/serializable/serialize.xml create mode 100644 language/predefined/serializable/unserialize.xml diff --git a/language/predefined/serializable.xml b/language/predefined/serializable.xml new file mode 100644 index 0000000000..e4bd4bc068 --- /dev/null +++ b/language/predefined/serializable.xml @@ -0,0 +1,120 @@ + + + + + + The Serializable class + Serializable + + + + +
+ &reftitle.intro; + + Interface for customized serializing. + + + + Classes that implement this interface no longer support + __sleep() and + __wakeup(). 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 + +
+ + +
+ &reftitle.classsynopsis; + + + + Serializable + + + + + Serializable + + + + + Methods + + + + +
+ +
+ + Basic usage + +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()); +?> +]]> + + &example.outputs.similar; + + + + +
+ + +
+ + &language.predefined.serializable.serialize; + &language.predefined.serializable.unserialize; + +
+ + diff --git a/language/predefined/serializable/serialize.xml b/language/predefined/serializable/serialize.xml new file mode 100644 index 0000000000..9bbe5842a6 --- /dev/null +++ b/language/predefined/serializable/serialize.xml @@ -0,0 +1,80 @@ + + + + + + Serializable::serialize + String representation of object + + + + &reftitle.description; + + abstract public stringSerializable::serialize + + + + Should return the string representation of the object. + + + + This method acts as the + destructor of the object. The + __destruct method will not be called after this + method. + + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns the string representation of the object or &null; + + + + + &reftitle.errors; + + Throws Exception when returning other types then strings and + &null; + + + + + &reftitle.seealso; + + + __sleep() + + + + + + + diff --git a/language/predefined/serializable/unserialize.xml b/language/predefined/serializable/unserialize.xml new file mode 100644 index 0000000000..c31bed877c --- /dev/null +++ b/language/predefined/serializable/unserialize.xml @@ -0,0 +1,83 @@ + + + + + + Serializable::unserialize + Constructs the object + + + + &reftitle.description; + + abstract public mixedSerializable::unserialize + stringserialized + + + Called during unserialization of the object. + + + + This method acts as the + constructor of the object. The + __construct method will not be called after this + method. + + + + + + &reftitle.parameters; + + + + serialized + + + The string representation of the object. + + + + + + + + + + &reftitle.returnvalues; + + Returns the original value unserialized. + + + + + &reftitle.seealso; + + + __wakeup() + + + + + + +