public getIniVersion ( string $iniString ) : integer | ||
$iniString | string | The loaded ini data |
return | integer |
public function getIniVersion($iniString)
{
$quoterHelper = new Quoter();
$key = $quoterHelper->pregQuote(self::BROWSCAP_VERSION_KEY);
if (preg_match('/\\.*\\[' . $key . '\\][^\\[]*Version=(\\d+)\\D.*/', $iniString, $matches)) {
if (isset($matches[1])) {
$this->iniVersion = (int) $matches[1];
}
}
return $this->iniVersion;
}
/** * */ public function testGetIniVersion() { $file = $this->getMock('\\BrowscapPHP\\Helper\\Filesystem', array('exists'), array(), '', false); $file->expects(self::never())->method('exists')->will(self::returnValue(false)); $this->object->setFilesystem($file); $content = ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Browscap Version [GJK_Browscap_Version] Version=5031 Released=Mon, 30 Jun 2014 17:55:58 +0200 Format=ASP Type='; self::assertSame(5031, $this->object->getIniVersion($content)); self::assertSame($this->object, $this->object->storeVersion()); }