12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace Symfony\Component\Config\Resource;
- class FileExistenceResource implements SelfCheckingResourceInterface, \Serializable
- {
- private $resource;
- private $exists;
-
- public function __construct($resource)
- {
- $this->resource = (string) $resource;
- $this->exists = file_exists($resource);
- }
-
- public function __toString()
- {
- return $this->resource;
- }
-
- public function getResource()
- {
- return $this->resource;
- }
-
- public function isFresh($timestamp)
- {
- return file_exists($this->resource) === $this->exists;
- }
-
- public function serialize()
- {
- return serialize(array($this->resource, $this->exists));
- }
-
- public function unserialize($serialized)
- {
- list($this->resource, $this->exists) = unserialize($serialized);
- }
- }
|