/** * Loads an application using its cached container. * * @param string $file The path to the cache file. * @param string $class The container class name. * @param boolean $debug Enable debugging? (see class doc) * * @return ApplicationCache The loaded application. * * @throws CacheException If the application could not be loaded. */ public static function load($file, $class = 'ConsoleContainer', $debug = true) { if (!file_exists($file)) { throw CacheException::fileNotExist($file); // @codeCoverageIgnore } $cache = new ConfigCache($file, $debug); if (!$cache->isFresh()) { throw CacheException::cacheStale($file); // @codeCoverageIgnore } /** @noinspection PhpIncludeInspection */ require_once $file; if (!class_exists($class)) { throw CacheException::classNotExist($class, $file); // @codeCoverageIgnore } return new static(new $class()); }