4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Config\Resource;
15 * ClassExistenceResource represents a class existence.
16 * Freshness is only evaluated against resource existence.
18 * The resource must be a fully-qualified class name.
20 * @author Fabien Potencier <fabien@symfony.com>
22 class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializable
28 * @param string $resource The fully-qualified class name
30 public function __construct($resource)
32 $this->resource = $resource;
33 $this->exists = class_exists($resource);
39 public function __toString()
41 return $this->resource;
45 * @return string The file path to the resource
47 public function getResource()
49 return $this->resource;
55 public function isFresh($timestamp)
57 return class_exists($this->resource) === $this->exists;
63 public function serialize()
65 return serialize(array($this->resource, $this->exists));
71 public function unserialize($serialized)
73 list($this->resource, $this->exists) = unserialize($serialized);