PHP Класс DeviceDetector\Parser\ParserAbstract

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$cache DeviceDetector\Cache\Cache | Doctrine\Common\Cache\CacheProvider
$fixtureFile string Holds the path to the yml file containing regexes
$globalMethods array Holds an array with method that should be available global
$maxMinorParts integer Indicates how deep versioning will be detected if $maxMinorParts is 0 only the major version will be returned
$parserName string Holds the internal name of the parser Used for caching
$regexList array Holds an array with regexes to parse, if already loaded
$userAgent string Holds the user agent the should be parsed
$yamlParser DeviceDetector\Yaml\Parser

Открытые методы

Метод Описание
__construct ( $ua = '' )
getCache ( ) : DeviceDetector\Cache\Cache | CacheProvider Returns Cache object
getName ( ) : string Returns the internal name of the parser
getYamlParser ( ) : DeviceDetector\Yaml\Parser Returns Cache object
parse ( )
setCache ( DeviceDetector\Cache\Cache | CacheProvider $cache ) Sets the Cache class
setUserAgent ( string $ua ) Sets the user agent to parse
setVersionTruncation ( integer | null $type ) Set how DeviceDetector should return versions
setYamlParser ( $yamlParser ) Sets the Cache class

Защищенные методы

Метод Описание
buildByMatch ( string $item, array $matches ) : string
buildVersion ( $versionString, $matches ) : mixed | string Builds the version with the given $versionString and $matches
getRegexes ( ) : array Returns the result of the parsed yml file defined in $fixtureFile
getRegexesDirectory ( ) : string
matchUserAgent ( $regex ) : array | boolean Matches the useragent against the given regex
preMatchOverall ( ) : boolean Tests the useragent against a combination of all regexes

Описание методов

__construct() публичный Метод

public __construct ( $ua = '' )

buildByMatch() защищенный Метод

protected buildByMatch ( string $item, array $matches ) : string
$item string
$matches array
Результат string type

buildVersion() защищенный Метод

Example: $versionString = 'v$2' $matches = array('version_1_0_1', '1_0_1') return value would be v1.0.1
protected buildVersion ( $versionString, $matches ) : mixed | string
$versionString
$matches
Результат mixed | string

getCache() публичный Метод

Returns Cache object
public getCache ( ) : DeviceDetector\Cache\Cache | CacheProvider
Результат DeviceDetector\Cache\Cache | Doctrine\Common\Cache\CacheProvider

getName() публичный Метод

Returns the internal name of the parser
public getName ( ) : string
Результат string

getRegexes() защищенный Метод

Returns the result of the parsed yml file defined in $fixtureFile
protected getRegexes ( ) : array
Результат array

getRegexesDirectory() защищенный Метод

protected getRegexesDirectory ( ) : string
Результат string

getYamlParser() публичный Метод

Returns Cache object
public getYamlParser ( ) : DeviceDetector\Yaml\Parser
Результат DeviceDetector\Yaml\Parser

matchUserAgent() защищенный Метод

Matches the useragent against the given regex
protected matchUserAgent ( $regex ) : array | boolean
$regex
Результат array | boolean

parse() абстрактный публичный Метод

abstract public parse ( )

preMatchOverall() защищенный Метод

All regexes returned by getRegexes() will be reversed and concated with '|' Afterwards the big regex will be tested against the user agent Method can be used to speed up detections by making a big check before doing checks for every single regex
protected preMatchOverall ( ) : boolean
Результат boolean

setCache() публичный Метод

Sets the Cache class
public setCache ( DeviceDetector\Cache\Cache | CacheProvider $cache )
$cache DeviceDetector\Cache\Cache | Doctrine\Common\Cache\CacheProvider

setUserAgent() публичный Метод

Sets the user agent to parse
public setUserAgent ( string $ua )
$ua string user agent

setVersionTruncation() публичный статический Метод

Set how DeviceDetector should return versions
public static setVersionTruncation ( integer | null $type )
$type integer | null Any of the VERSION_TRUNCATION_* constants

setYamlParser() публичный Метод

Sets the Cache class
public setYamlParser ( $yamlParser )

Описание свойств

$cache защищенное свойство

protected Cache,DeviceDetector\Cache|CacheProvider,Doctrine\Common\Cache $cache
Результат DeviceDetector\Cache\Cache | Doctrine\Common\Cache\CacheProvider

$fixtureFile защищенное свойство

Holds the path to the yml file containing regexes
protected string $fixtureFile
Результат string

$globalMethods защищенное свойство

Holds an array with method that should be available global
protected array $globalMethods
Результат array

$maxMinorParts защищенное статическое свойство

Indicates how deep versioning will be detected if $maxMinorParts is 0 only the major version will be returned
protected static int $maxMinorParts
Результат integer

$parserName защищенное свойство

Holds the internal name of the parser Used for caching
protected string $parserName
Результат string

$regexList защищенное свойство

Holds an array with regexes to parse, if already loaded
protected array $regexList
Результат array

$userAgent защищенное свойство

Holds the user agent the should be parsed
protected string $userAgent
Результат string

$yamlParser защищенное свойство

protected Parser,DeviceDetector\Yaml $yamlParser
Результат DeviceDetector\Yaml\Parser