PHP 클래스 DeviceDetector\DeviceDetector

Magic Device Type Methods
파일 보기 프로젝트 열기: piwik/device-detector 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$clientTypes array Holds all registered client types

보호된 프로퍼티들

프로퍼티 타입 설명
$bot array | boolean If $discardBotInformation is set to true, this property will be set to true if parsed UA is identified as bot, additional information will be not available If $skipBotDetection is set to true, bot detection will not be performed and isBot will always be false
$brand string Holds the device brand data after parsing the UA
$cache DeviceDetector\Cache\Cache | Doctrine\Common\Cache\CacheProvider Holds the cache class used for caching the parsed yml-Files
$client array Holds the client data after parsing the UA
$clientParsers DeviceDetector\Parser\Client\ClientParserAbstract[]
$desktopOsArray array Operating system families that are known as desktop only
$device string Holds the device type after parsing the UA
$deviceParsers DeviceDetector\Parser\Device\DeviceParserAbstract[]
$discardBotInformation boolean
$model string Holds the device model data after parsing the UA
$os array Holds the operating system data after parsing the UA
$skipBotDetection boolean
$userAgent string Holds the useragent that should be parsed
$yamlParser DeviceDetector\Yaml\Parser Holds the parser class used for parsing yml-Files

공개 메소드들

메소드 설명
__call ( $methodName, $arguments )
__construct ( string $userAgent = '' ) Constructor
addClientParser ( DeviceDetector\Parser\Client\ClientParserAbstract | string $parser )
addDeviceParser ( DeviceParserAbstract | string $parser )
discardBotInformation ( boolean $discard = true ) Sets whether to discard additional bot information If information is discarded it's only possible check whether UA was detected as bot or not.
getBot ( ) : array Returns the bot extracted from the parsed UA
getBrand ( ) : string Returns the device brand extracted from the parsed UA
getBrandName ( ) : string Returns the full device brand name extracted from the parsed UA
getCache ( ) : CacheProvider Returns Cache object
getClient ( string $attr = '' ) : array | string Returns the client data extracted from the parsed UA
getClientParsers ( )
getDevice ( ) : integer | null Returns the device type extracted from the parsed UA
getDeviceName ( ) : string Returns the device type extracted from the parsed UA
getDeviceParsers ( )
getInfoFromUserAgent ( string $ua ) : array Parses a useragent and returns the detected data
getModel ( ) : string Returns the device model extracted from the parsed UA
getOs ( string $attr = '' ) : array | string Returns the operating system data extracted from the parsed UA
getUserAgent ( ) : string Returns the user agent that is set to be parsed
getYamlParser ( ) : DeviceDetector\Yaml\Parser Returns Yaml Parser object
isBot ( ) : boolean Returns if the parsed UA was identified as a Bot
isDesktop ( ) : boolean Returns if the parsed UA was identified as desktop device Desktop devices are all devices with an unknown type that are running a desktop os
isMobile ( )
isParsed ( ) : boolean Returns true, if userAgent was already parsed with parse()
isTouchEnabled ( ) : boolean Returns if the parsed UA was identified as a touch enabled device
parse ( ) Triggers the parsing of the current user agent
setCache ( DeviceDetector\Cache\Cache | CacheProvider $cache ) Sets the Cache class
setUserAgent ( string $userAgent ) Sets the useragent to be parsed
setYamlParser ( $yamlParser ) Sets the Yaml Parser class
skipBotDetection ( boolean $skip = true ) Sets whether to skip bot detection.

보호된 메소드들

메소드 설명
hasAndroidMobileFragment ( ) : boolean Returns if the parsed UA contains the 'Android; Mobile;' fragment
hasAndroidTableFragment ( ) : boolean Returns if the parsed UA contains the 'Android; Tablet;' fragment
matchUserAgent ( $regex )
parseBot ( ) Parses the UA for bot information using the Bot parser
parseClient ( )
parseDevice ( )
parseOs ( )
reset ( )
usesMobileBrowser ( )

메소드 상세

__call() 공개 메소드

public __call ( $methodName, $arguments )

__construct() 공개 메소드

Constructor
public __construct ( string $userAgent = '' )
$userAgent string UA to parse

addClientParser() 공개 메소드

public addClientParser ( DeviceDetector\Parser\Client\ClientParserAbstract | string $parser )
$parser DeviceDetector\Parser\Client\ClientParserAbstract | string

addDeviceParser() 공개 메소드

public addDeviceParser ( DeviceParserAbstract | string $parser )
$parser DeviceDetector\Parser\Device\DeviceParserAbstract | string

discardBotInformation() 공개 메소드

(Discarding information speeds up the detection a bit)
public discardBotInformation ( boolean $discard = true )
$discard boolean

getBot() 공개 메소드

Returns the bot extracted from the parsed UA
public getBot ( ) : array
리턴 array

getBrand() 공개 메소드

Returns the device brand extracted from the parsed UA
또한 보기: self::$deviceBrand for available device brands
public getBrand ( ) : string
리턴 string

getBrandName() 공개 메소드

Returns the full device brand name extracted from the parsed UA
또한 보기: self::$deviceBrand for available device brands
public getBrandName ( ) : string
리턴 string

getCache() 공개 메소드

Returns Cache object
public getCache ( ) : CacheProvider
리턴 Doctrine\Common\Cache\CacheProvider

getClient() 공개 메소드

If $attr is given only that property will be returned
public getClient ( string $attr = '' ) : array | string
$attr string property to return(optional)
리턴 array | string

getClientParsers() 공개 메소드

public getClientParsers ( )

getDevice() 공개 메소드

Returns the device type extracted from the parsed UA
또한 보기: DeviceParserAbstract::$deviceTypes for available device types
public getDevice ( ) : integer | null
리턴 integer | null

getDeviceName() 공개 메소드

Returns the device type extracted from the parsed UA
또한 보기: DeviceParserAbstract::$deviceTypes for available device types
public getDeviceName ( ) : string
리턴 string

getDeviceParsers() 공개 메소드

public getDeviceParsers ( )

getInfoFromUserAgent() 공개 정적인 메소드

ATTENTION: Use that method only for testing or very small applications To get fast results from DeviceDetector you need to make your own implementation, that should use one of the caching mechanisms. See README.md for more information.
사용 중단:
public static getInfoFromUserAgent ( string $ua ) : array
$ua string UserAgent to parse
리턴 array

getModel() 공개 메소드

Returns the device model extracted from the parsed UA
public getModel ( ) : string
리턴 string

getOs() 공개 메소드

If $attr is given only that property will be returned
public getOs ( string $attr = '' ) : array | string
$attr string property to return(optional)
리턴 array | string

getUserAgent() 공개 메소드

Returns the user agent that is set to be parsed
public getUserAgent ( ) : string
리턴 string

getYamlParser() 공개 메소드

Returns Yaml Parser object
public getYamlParser ( ) : DeviceDetector\Yaml\Parser
리턴 DeviceDetector\Yaml\Parser

hasAndroidMobileFragment() 보호된 메소드

Returns if the parsed UA contains the 'Android; Mobile;' fragment
protected hasAndroidMobileFragment ( ) : boolean
리턴 boolean

hasAndroidTableFragment() 보호된 메소드

Returns if the parsed UA contains the 'Android; Tablet;' fragment
protected hasAndroidTableFragment ( ) : boolean
리턴 boolean

isBot() 공개 메소드

Returns if the parsed UA was identified as a Bot
public isBot ( ) : boolean
리턴 boolean

isDesktop() 공개 메소드

Returns if the parsed UA was identified as desktop device Desktop devices are all devices with an unknown type that are running a desktop os
또한 보기: self::$desktopOsArray
public isDesktop ( ) : boolean
리턴 boolean

isMobile() 공개 메소드

public isMobile ( )

isParsed() 공개 메소드

Returns true, if userAgent was already parsed with parse()
public isParsed ( ) : boolean
리턴 boolean

isTouchEnabled() 공개 메소드

Note: That only applies to windows 8 tablets
public isTouchEnabled ( ) : boolean
리턴 boolean

matchUserAgent() 보호된 메소드

protected matchUserAgent ( $regex )

parse() 공개 메소드

Triggers the parsing of the current user agent
public parse ( )

parseBot() 보호된 메소드

Parses the UA for bot information using the Bot parser
protected parseBot ( )

parseClient() 보호된 메소드

protected parseClient ( )

parseDevice() 보호된 메소드

protected parseDevice ( )

parseOs() 보호된 메소드

protected parseOs ( )

reset() 보호된 메소드

protected reset ( )

setCache() 공개 메소드

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

setUserAgent() 공개 메소드

Sets the useragent to be parsed
public setUserAgent ( string $userAgent )
$userAgent string

setYamlParser() 공개 메소드

Sets the Yaml Parser class
public setYamlParser ( $yamlParser )

skipBotDetection() 공개 메소드

It is needed if we want bots to be processed as a simple clients. So we can detect if it is mobile client, or desktop, or enything else. By default all this information is not retrieved for the bots.
public skipBotDetection ( boolean $skip = true )
$skip boolean

usesMobileBrowser() 보호된 메소드

protected usesMobileBrowser ( )

프로퍼티 상세

$bot 보호되어 있는 프로퍼티

If $discardBotInformation is set to true, this property will be set to true if parsed UA is identified as bot, additional information will be not available If $skipBotDetection is set to true, bot detection will not be performed and isBot will always be false
protected array|bool $bot
리턴 array | boolean

$brand 보호되어 있는 프로퍼티

Holds the device brand data after parsing the UA
protected string $brand
리턴 string

$cache 보호되어 있는 프로퍼티

Holds the cache class used for caching the parsed yml-Files
protected Cache,DeviceDetector\Cache|CacheProvider,Doctrine\Common\Cache $cache
리턴 DeviceDetector\Cache\Cache | Doctrine\Common\Cache\CacheProvider

$client 보호되어 있는 프로퍼티

Holds the client data after parsing the UA
protected array $client
리턴 array

$clientParsers 보호되어 있는 프로퍼티

protected ClientParserAbstract[],DeviceDetector\Parser\Client $clientParsers
리턴 DeviceDetector\Parser\Client\ClientParserAbstract[]

$clientTypes 공개적으로 정적으로 프로퍼티

Holds all registered client types
public static array $clientTypes
리턴 array

$desktopOsArray 보호되어 있는 정적으로 프로퍼티

Operating system families that are known as desktop only
protected static array $desktopOsArray
리턴 array

$device 보호되어 있는 프로퍼티

Holds the device type after parsing the UA
protected string $device
리턴 string

$deviceParsers 보호되어 있는 프로퍼티

protected DeviceParserAbstract[],DeviceDetector\Parser\Device $deviceParsers
리턴 DeviceDetector\Parser\Device\DeviceParserAbstract[]

$discardBotInformation 보호되어 있는 프로퍼티

protected bool $discardBotInformation
리턴 boolean

$model 보호되어 있는 프로퍼티

Holds the device model data after parsing the UA
protected string $model
리턴 string

$os 보호되어 있는 프로퍼티

Holds the operating system data after parsing the UA
protected array $os
리턴 array

$skipBotDetection 보호되어 있는 프로퍼티

protected bool $skipBotDetection
리턴 boolean

$userAgent 보호되어 있는 프로퍼티

Holds the useragent that should be parsed
protected string $userAgent
리턴 string

$yamlParser 보호되어 있는 프로퍼티

Holds the parser class used for parsing yml-Files
protected Parser,DeviceDetector\Yaml $yamlParser
리턴 DeviceDetector\Yaml\Parser