diff --git a/.gitignore b/.gitignore index d822fd3..f8a16bc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /coveralls-upload.json /phpunit.xml /vendor/ +/.phpunit.result.cache diff --git a/src/Collector/AbstractCollector.php b/src/Collector/AbstractCollector.php index 5250e3e..39728b5 100644 --- a/src/Collector/AbstractCollector.php +++ b/src/Collector/AbstractCollector.php @@ -2,11 +2,13 @@ namespace Laminas\DeveloperTools\Collector; +use Serializable; + /** * Serializable Collector base class. * */ -abstract class AbstractCollector implements CollectorInterface, \Serializable +abstract class AbstractCollector implements CollectorInterface, Serializable { /** * Collected Data @@ -15,19 +17,31 @@ abstract class AbstractCollector implements CollectorInterface, \Serializable */ protected $data; + public function __serialize() + { + return serialize($this->data); + } + /** - * @see \Serializable + * @deprecated since 2.3.0, this method will be removed in version 3.0.0 of this component. + * {@see Serializable} as alternative */ public function serialize() { - return serialize($this->data); + return $this->__serialize(); + } + + public function __unserialize($data) + { + $this->data = unserialize($data); } /** - * @see \Serializable + * @deprecated since 2.3.0, this method will be removed in version 3.0.0 of this component. + * {@see Serializable} as alternative */ public function unserialize($data) { - $this->data = unserialize($data); + $this->__unserialize($data); } } diff --git a/src/Collector/ConfigCollector.php b/src/Collector/ConfigCollector.php index d5d114d..c9c9709 100644 --- a/src/Collector/ConfigCollector.php +++ b/src/Collector/ConfigCollector.php @@ -79,24 +79,36 @@ public function getApplicationConfig() return isset($this->applicationConfig) ? $this->unserializeArray($this->applicationConfig) : null; } - /** - * {@inheritDoc} - */ - public function serialize() + public function __serialize() { return serialize(['config' => $this->config, 'applicationConfig' => $this->applicationConfig]); } /** - * {@inheritDoc} + * @deprecated since 2.3.0, this method will be removed in version 3.0.0 of this component. + * {@see Serializable} as alternative */ - public function unserialize($serialized) + public function serialize() + { + return $this->__serialize(); + } + + public function __unserialize($serialized) { $data = unserialize($serialized); $this->config = $data['config']; $this->applicationConfig = $data['applicationConfig']; } + /** + * @deprecated since 2.3.0, this method will be removed in version 3.0.0 of this component. + * {@see Serializable} as alternative + */ + public function unserialize($serialized) + { + $this->__unserialize($serialized); + } + /** * Replaces the un-serializable items in an array with stubs * diff --git a/src/Collector/DbCollector.php b/src/Collector/DbCollector.php index 4a0a25a..71a287f 100644 --- a/src/Collector/DbCollector.php +++ b/src/Collector/DbCollector.php @@ -121,19 +121,31 @@ public function getQueryTime($mode = null) return $time; } + public function __serialize() + { + return serialize($this->profiler); + } + /** - * @see Serializable + * @deprecated since 2.3.0, this method will be removed in version 3.0.0 of this component. + * {@see Serializable} as alternative */ public function serialize() { - return serialize($this->profiler); + return $this->__serialize(); + } + + public function __unserialize($profiler) + { + $this->profiler = unserialize($profiler); } /** - * @see Serializable + * @deprecated since 2.3.0, this method will be removed in version 3.0.0 of this component. + * {@see Serializable} as alternative */ public function unserialize($profiler) { - $this->profiler = unserialize($profiler); + $this->__unserialize($profiler); } } diff --git a/src/Exception/SerializableException.php b/src/Exception/SerializableException.php index a0c9922..7c34334 100644 --- a/src/Exception/SerializableException.php +++ b/src/Exception/SerializableException.php @@ -192,19 +192,31 @@ protected function filterArgs($args, $level = 0) return $result; } + public function __serialize() + { + return serialize($this->data); + } + /** - * @see \Serializable + * @deprecated since 2.3.0, this method will be removed in version 3.0.0 of this component. + * {@see Serializable} as alternative */ public function serialize() { - return serialize($this->data); + return $this->__serialize(); + } + + public function __unserialize($data) + { + $this->data = unserialize($data); } /** - * @see \Serializable + * @deprecated since 2.3.0, this method will be removed in version 3.0.0 of this component. + * {@see Serializable} as alternative */ public function unserialize($data) { - $this->data = unserialize($data); + $this->__unserialize($data); } }