PHP Class BrowscapPHP\Browscap

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])
ファイルを表示 Open project: browscap/browscap-php Class Usage Examples

Public Methods

Method Description
getBrowser ( string $userAgent = null ) : stdClass parses the given user agent to get the information about the browser
getCache ( ) : BrowscapPHP\Cache\BrowscapCacheInterface Gets a cache instance
getFormatter ( ) : BrowscapPHP\Formatter\FormatterInterface
getLogger ( ) : Psr\Log\LoggerInterface returns a logger instance
getParser ( ) : BrowscapPHP\Parser\ParserInterface returns an instance of the used parser class
setCache ( BrowscapPHP\Cache\BrowscapCacheInterface | WurflCache\Adapter\AdapterInterface $cache ) : Browscap Sets a cache instance
setFormatter ( BrowscapPHP\Formatter\FormatterInterface $formatter ) : Browscap Set theformatter instance to use for the getBrowser() result
setLogger ( Psr\Log\LoggerInterface $logger ) : Browscap Sets a logger instance
setParser ( BrowscapPHP\Parser\ParserInterface $parser ) : Browscap Sets the parser instance to use

Method Details

getBrowser() public method

if no user agent is given, it uses {@see \BrowscapPHP\Helper\Support} to get it
public getBrowser ( string $userAgent = null ) : stdClass
$userAgent string the user agent string
return stdClass the object containing the browsers details. Array if $return_array is set to true.

getCache() public method

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

getFormatter() public method

public getFormatter ( ) : BrowscapPHP\Formatter\FormatterInterface
return BrowscapPHP\Formatter\FormatterInterface

getLogger() public method

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

getParser() public method

returns an instance of the used parser class
public getParser ( ) : BrowscapPHP\Parser\ParserInterface
return BrowscapPHP\Parser\ParserInterface

setCache() public method

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

setFormatter() public method

Set theformatter instance to use for the getBrowser() result
public setFormatter ( BrowscapPHP\Formatter\FormatterInterface $formatter ) : Browscap
$formatter BrowscapPHP\Formatter\FormatterInterface
return Browscap

setLogger() public method

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

setParser() public method

Sets the parser instance to use
public setParser ( BrowscapPHP\Parser\ParserInterface $parser ) : Browscap
$parser BrowscapPHP\Parser\ParserInterface
return Browscap