PHP Class BrowscapPHP\BrowscapUpdater

Author: Jonathan Stoppani ([email protected])
Author: Vítor Brandão ([email protected])
Author: Mikołaj Misiurewicz ([email protected])
Author: Christoph Ziegenberg ([email protected])
Author: Thomas Müller ([email protected])
Datei anzeigen Open project: browscap/browscap-php Class Usage Examples

Public Methods

Method Description
checkUpdate ( ) : integer | null checks if an update on a remote location for the local file or the cache
convertFile ( string $iniFile ) reads and parses an ini file and writes the results into the cache
convertString ( string $iniString ) reads and parses an ini string and writes the results into the cache
fetch ( string $file, string $remoteFile = IniLoader::PHP_INI ) fetches a remote file and stores it into a local folder
getCache ( ) : BrowscapPHP\Cache\BrowscapCacheInterface Gets a cache instance
getClient ( ) : Client
getLogger ( ) : Psr\Log\LoggerInterface returns a logger instance
setCache ( BrowscapPHP\Cache\BrowscapCacheInterface | WurflCache\Adapter\AdapterInterface $cache ) : BrowscapUpdater Sets a cache instance
setClient ( Client $client )
setLogger ( Psr\Log\LoggerInterface $logger ) : BrowscapUpdater Sets a logger instance
update ( string $remoteFile = IniLoader::PHP_INI ) fetches a remote file, parses it and writes the result into the cache

Private Methods

Method Description
sanitizeContent ( string $content ) : mixed
storeContent ( Converter $converter, string $content, integer | null $cachedVersion ) reads and parses an ini string and writes the results into the cache

Method Details

checkUpdate() public method

checks if an update on a remote location for the local file or the cache
public checkUpdate ( ) : integer | null
return integer | null The actual cached version if a newer version is available, null otherwise

convertFile() public method

reads and parses an ini file and writes the results into the cache
public convertFile ( string $iniFile )
$iniFile string

convertString() public method

reads and parses an ini string and writes the results into the cache
public convertString ( string $iniString )
$iniString string

fetch() public method

fetches a remote file and stores it into a local folder
public fetch ( string $file, string $remoteFile = IniLoader::PHP_INI )
$file string The name of the file where to store the remote content
$remoteFile string The code for the remote file to load

getCache() public method

Gets a cache instance
public getCache ( ) : BrowscapPHP\Cache\BrowscapCacheInterface
return BrowscapPHP\Cache\BrowscapCacheInterface

getClient() public method

public getClient ( ) : Client
return GuzzleHttp\Client

getLogger() public method

returns a logger instance
public getLogger ( ) : Psr\Log\LoggerInterface
return Psr\Log\LoggerInterface

setCache() public method

Sets a cache instance
public setCache ( BrowscapPHP\Cache\BrowscapCacheInterface | WurflCache\Adapter\AdapterInterface $cache ) : BrowscapUpdater
$cache BrowscapPHP\Cache\BrowscapCacheInterface | WurflCache\Adapter\AdapterInterface
return BrowscapUpdater

setClient() public method

public setClient ( Client $client )
$client GuzzleHttp\Client

setLogger() public method

Sets a logger instance
public setLogger ( Psr\Log\LoggerInterface $logger ) : BrowscapUpdater
$logger Psr\Log\LoggerInterface
return BrowscapUpdater

update() public method

if the local stored information are in the same version as the remote data no actions are taken
public update ( string $remoteFile = IniLoader::PHP_INI )
$remoteFile string The code for the remote file to load