composer package updates
[openemr.git] / vendor / symfony / config / ConfigCache.php
blob016e014b6c516a051d8fa8c0234e94757816c8b4
1 <?php
3 /*
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;
14 use Symfony\Component\Config\Resource\BCResourceInterfaceChecker;
15 use Symfony\Component\Config\Resource\SelfCheckingResourceChecker;
17 /**
18 * ConfigCache caches arbitrary content in files on disk.
20 * When in debug mode, those metadata resources that implement
21 * \Symfony\Component\Config\Resource\SelfCheckingResourceInterface will
22 * be used to check cache freshness.
24 * During a transition period, also instances of
25 * \Symfony\Component\Config\Resource\ResourceInterface will be checked
26 * by means of the isFresh() method. This behaviour is deprecated since 2.8
27 * and will be removed in 3.0.
29 * @author Fabien Potencier <fabien@symfony.com>
30 * @author Matthias Pigulla <mp@webfactory.de>
32 class ConfigCache extends ResourceCheckerConfigCache
34 private $debug;
36 /**
37 * @param string $file The absolute cache path
38 * @param bool $debug Whether debugging is enabled or not
40 public function __construct($file, $debug)
42 parent::__construct($file, array(
43 new SelfCheckingResourceChecker(),
44 new BCResourceInterfaceChecker(),
45 ));
46 $this->debug = (bool) $debug;
49 /**
50 * Gets the cache file path.
52 * @return string The cache file path
54 * @deprecated since 2.7, to be removed in 3.0. Use getPath() instead.
56 public function __toString()
58 @trigger_error('ConfigCache::__toString() is deprecated since Symfony 2.7 and will be removed in 3.0. Use the getPath() method instead.', E_USER_DEPRECATED);
60 return $this->getPath();
63 /**
64 * Checks if the cache is still fresh.
66 * This implementation always returns true when debug is off and the
67 * cache file exists.
69 * @return bool true if the cache is fresh, false otherwise
71 public function isFresh()
73 if (!$this->debug && is_file($this->getPath())) {
74 return true;
77 return parent::isFresh();