[Config] Implemented Serializable on resources
This commit is contained in:
parent
c2fa73d33a
commit
cbd0c3c8e9
@ -16,7 +16,7 @@ namespace Symfony\Component\Config\Resource;
|
|||||||
*
|
*
|
||||||
* @author Fabien Potencier <fabien@symfony.com>
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
*/
|
*/
|
||||||
class DirectoryResource implements ResourceInterface
|
class DirectoryResource implements ResourceInterface, \Serializable
|
||||||
{
|
{
|
||||||
private $resource;
|
private $resource;
|
||||||
private $pattern;
|
private $pattern;
|
||||||
@ -89,4 +89,14 @@ class DirectoryResource implements ResourceInterface
|
|||||||
|
|
||||||
return $newestMTime < $timestamp;
|
return $newestMTime < $timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function serialize()
|
||||||
|
{
|
||||||
|
return serialize(array($this->resource, $this->pattern));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function unserialize($serialized)
|
||||||
|
{
|
||||||
|
list($this->resource, $this->pattern) = unserialize($serialized);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace Symfony\Component\Config\Resource;
|
|||||||
*
|
*
|
||||||
* @author Fabien Potencier <fabien@symfony.com>
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
*/
|
*/
|
||||||
class FileResource implements ResourceInterface
|
class FileResource implements ResourceInterface, \Serializable
|
||||||
{
|
{
|
||||||
private $resource;
|
private $resource;
|
||||||
|
|
||||||
@ -67,4 +67,14 @@ class FileResource implements ResourceInterface
|
|||||||
|
|
||||||
return filemtime($this->resource) < $timestamp;
|
return filemtime($this->resource) < $timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function serialize()
|
||||||
|
{
|
||||||
|
return serialize($this->resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function unserialize($serialized)
|
||||||
|
{
|
||||||
|
$this->resource = unserialize($serialized);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user