123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace Symfony\Component\Config;
- class ConfigCacheFactory implements ConfigCacheFactoryInterface
- {
- private $debug;
-
- public function __construct($debug)
- {
- $this->debug = $debug;
- }
-
- public function cache($file, $callback)
- {
- if (!\is_callable($callback)) {
- throw new \InvalidArgumentException(sprintf('Invalid type for callback argument. Expected callable, but got "%s".', \gettype($callback)));
- }
- $cache = new ConfigCache($file, $this->debug);
- if (!$cache->isFresh()) {
- \call_user_func($callback, $cache);
- }
- return $cache;
- }
- }
|