public getCache ( ) : BrowscapPHP\Cache\BrowscapCacheInterface | ||
return | BrowscapPHP\Cache\BrowscapCacheInterface |
public function getCache()
{
if (null === $this->cache) {
$cacheDirectory = __DIR__ . '/../resources/';
$cacheAdapter = new File([File::DIR => $cacheDirectory]);
$this->cache = new BrowscapCache($cacheAdapter);
}
return $this->cache;
}
public function __construct(Browscap $parser, $expectedType = '') { $this->parser = $parser; if ($parser->getCache()->getType() === null) { throw new InvalidArgumentException('You need to warm-up the cache first to use this provider'); } if ($expectedType !== $parser->getCache()->getType()) { throw new InvalidArgumentException('Expected the "' . $expectedType . '" data file. Instead got the "' . $parser->getCache()->getType() . '" data file'); } }