Esempio n. 1
0
function buildPersistenceWith($wurflConfig)
{
    $persistenceStorage = WURFL_Storage_Factory::create($wurflConfig->persistence);
    $context = new WURFL_Context($persistenceStorage);
    $userAgentHandlerChain = WURFL_UserAgentHandlerChainFactory::createFrom($context);
    $devicePatcher = new WURFL_Xml_DevicePatcher();
    $deviceRepositoryBuilder = new WURFL_DeviceRepositoryBuilder($persistenceStorage, $userAgentHandlerChain, $devicePatcher);
    return $deviceRepositoryBuilder->build($wurflConfig->wurflFile, $wurflConfig->wurflPatches);
}
 /**
  * Create a new WURFL Manager Factory
  * @param WURFL_Configuration_Config $wurflConfig
  * @param WURFL_Storage_Base $persistenceStorage
  * @param WURFL_Storage_Base $cacheStorage
  */
 public function __construct(WURFL_Configuration_Config $wurflConfig, $persistenceStorage = null, $cacheStorage = null)
 {
     $this->wurflConfig = $wurflConfig;
     WURFL_Configuration_ConfigHolder::setWURFLConfig($this->wurflConfig);
     $this->persistenceStorage = $persistenceStorage ? $persistenceStorage : WURFL_Storage_Factory::create($this->wurflConfig->persistence);
     $this->cacheStorage = $cacheStorage ? $cacheStorage : WURFL_Storage_Factory::create($this->wurflConfig->cache);
     if ($this->persistenceStorage->validSecondaryCache($this->cacheStorage)) {
         $this->persistenceStorage->setCacheStorage($this->cacheStorage);
     }
 }
Esempio n. 3
0
function buildPersistenceWith($wurflConfig)
{
    $force_rebuild = true;
    $persistenceStorage = WURFL_Storage_Factory::create($wurflConfig->persistence);
    if ($force_rebuild) {
        $persistenceStorage->clear();
    }
    $context = new WURFL_Context($persistenceStorage);
    $userAgentHandlerChain = WURFL_UserAgentHandlerChainFactory::createFrom($context);
    $devicePatcher = new WURFL_Xml_DevicePatcher();
    $deviceRepositoryBuilder = new WURFL_DeviceRepositoryBuilder($persistenceStorage, $userAgentHandlerChain, $devicePatcher);
    return $deviceRepositoryBuilder->build($wurflConfig->wurflFile, $wurflConfig->wurflPatches, $wurflConfig->capabilityFilter);
}
 /**
  * Returns a Cache Storage object
  * @param array $cacheConfig
  * @return WURFL_Storage_Base
  * @see WURFL_Storage_Factory::create()
  */
 private static function cacheProvider($cacheConfig)
 {
     return WURFL_Storage_Factory::create($cacheConfig);
 }