PHP Class BrowscapPHP\Parser\Helper\GetPattern

Author: Christoph Ziegenberg ([email protected])
Author: Thomas Müller ([email protected])
Inheritance: implements BrowscapPHP\Parser\Helper\GetPatternInterface
显示文件 Open project: browscap/browscap-php Class Usage Examples

Public Methods

Method Description
__construct ( BrowscapPHP\Cache\BrowscapCacheInterface $cache, Psr\Log\LoggerInterface $logger ) class contructor
getPatterns ( string $userAgent ) : Generator Gets some possible patterns that have to be matched against the user agent. With the given user agent string, we can optimize the search for potential patterns: - We check the first characters of the user agent (or better: a hash, generated from it) - We compare the length of the pattern with the length of the user agent (the pattern cannot be longer than the user agent!)

Method Details

__construct() public method

class contructor
public __construct ( BrowscapPHP\Cache\BrowscapCacheInterface $cache, Psr\Log\LoggerInterface $logger )
$cache BrowscapPHP\Cache\BrowscapCacheInterface
$logger Psr\Log\LoggerInterface

getPatterns() public method

Gets some possible patterns that have to be matched against the user agent. With the given user agent string, we can optimize the search for potential patterns: - We check the first characters of the user agent (or better: a hash, generated from it) - We compare the length of the pattern with the length of the user agent (the pattern cannot be longer than the user agent!)
public getPatterns ( string $userAgent ) : Generator
$userAgent string
return Generator