BrowscapPHP\Helper\Converter::convertString PHP Method

convertString() public method

public convertString ( string $iniString )
$iniString string
    public function convertString($iniString)
    {
        $iniParser = new IniParser();
        $this->logger->info('start creating patterns from the ini data');
        foreach ($iniParser->createPatterns($iniString) as $patternsHashList) {
            foreach ($patternsHashList as $subkey => $content) {
                if (!$this->cache->setItem('browscap.patterns.' . $subkey, $content, true)) {
                    $this->logger->error('could not write pattern data "' . $subkey . '" to the cache');
                }
            }
        }
        $this->logger->info('finished creating patterns from the ini data');
        $this->logger->info('start creating data from the ini data');
        foreach ($iniParser->createIniParts($iniString) as $patternsContentList) {
            foreach ($patternsContentList as $subkey => $content) {
                if (!$this->cache->setItem('browscap.iniparts.' . $subkey, $content, true)) {
                    $this->logger->error('could not write property data "' . $subkey . '" to the cache');
                }
            }
        }
        $this->cache->setItem('browscap.releaseDate', $this->getIniReleaseDate($iniString), false);
        $this->cache->setItem('browscap.type', $this->getIniType($iniString), false);
        $this->logger->info('finished creating data from the ini data');
    }

Usage Example

Example #1
0
 /**
  * reads and parses an ini string and writes the results into the cache
  *
  * @param string $iniString
  */
 public function convertString($iniString)
 {
     $converter = new Converter($this->getLogger(), $this->getCache());
     $converter->convertString($iniString);
 }
All Usage Examples Of BrowscapPHP\Helper\Converter::convertString