public convertFile ( string $iniFile ) | ||
$iniFile | string |
public function convertFile($iniFile)
{
if (empty($iniFile)) {
throw new Exception('the file name can not be empty');
}
if (!is_readable($iniFile)) {
throw new Exception('it was not possible to read the local file ' . $iniFile);
}
try {
$iniString = file_get_contents($iniFile);
} catch (Helper\Exception $e) {
throw new Exception('an error occured while converting the local file into the cache', 0, $e);
}
$this->convertString($iniString);
}
protected function getParserWithWarmCache($type) { $filename = 'php_browscap.ini'; if ($type != '') { $filename = $type . '_' . $filename; } $cache = new \WurflCache\Adapter\Memory(); $browscap = new Browscap(); $browscap->setCache($cache); $updater = new BrowscapUpdater(); $updater->setCache($cache); $updater->convertFile('tests/resources/browscap/' . $filename); return $browscap; }