Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

implemented Serializable

  • Loading branch information...
commit e0035110a8d85558040bef1db5d2b2b8ed73fce2 1 parent 10ab1a6
pce authored
Showing with 25 additions and 1 deletion.
  1. +25 −1 Config/Lite.php
View
26 Config/Lite.php
@@ -38,7 +38,7 @@
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @link https://github.com/pce/config_lite
*/
-class Config_Lite implements ArrayAccess, IteratorAggregate, Countable
+class Config_Lite implements ArrayAccess, IteratorAggregate, Countable, Serializable
{
/**
* sections, holds the config sections
@@ -777,6 +777,30 @@ public function count()
}
/**
+ * implemented for interface Serializable
+ *
+ * @see http://php.net/manual/en/class.serializable.php
+ * @return int
+ */
+ public function serialize()
+ {
+ return serialize($this->sections);
+ }
+
+ /**
+ * implemented for interface Serializable
+ *
+ * @param string $serializedData for instance
+ *
+ * @return void
+ */
+ public function unserialize($serializedData)
+ {
+ $sections = unserialize($serializedData);
+ $this->sections = $sections;
+ }
+
+ /**
* takes an optional filename, if the file exists, also reads it.
*
* the `save' and `read' methods relies on a setted filename,
Please sign in to comment.
Something went wrong with that request. Please try again.