PHP Class Jenssegers\Agent\Agent

Inheritance: extends Mobile_Detec\Mobile_Detect
ファイルを表示 Open project: jenssegers/agent Class Usage Examples

Protected Properties

Property Type Description
$additionalBrowsers array Note: 'Vivaldi' must be above Chrome, otherwise it'll fail
$additionalDevices array List of desktop devices.
$additionalOperatingSystems array List of additional operating systems.
$additionalProperties array List of additional properties.
$robots array List of robots.

Public Methods

Method Description
__call ( $name, $arguments ) Changing detection type to extended.
browser ( $userAgent = null ) : string Get the browser name.
device ( string $userAgent = null ) : string Get the device name.
getDetectionRulesExtended ( ) : array Get all detection rules. These rules include the additional platforms and browsers.
getRules ( ) : array Retrieve the current set of rules.
isDesktop ( string $userAgent = null, array $httpHeaders = null ) : boolean Check if the device is a desktop computer.
isPhone ( string $userAgent = null, array $httpHeaders = null ) : boolean Check if the device is a mobile phone.
isRobot ( string $userAgent = null ) : boolean Check if device is a robot.
languages ( $acceptLanguage = null ) : array Get accept languages.
platform ( string $userAgent = null ) : string Get the platform name.
robot ( string $userAgent = null ) : string Get the robot name.
version ( $propertyName, $type = self::VERSION_TYPE_STRING ) Check the version of the given property in the User-Agent.

Protected Methods

Method Description
findDetectionRulesAgainstUA ( array $rules, null $userAgent = null ) : string Match a detection rule and return the matched key.
mergeRules ( ) : array Merge multiple rules into one array.

Method Details

__call() public method

Changing detection type to extended.
public __call ( $name, $arguments )

browser() public method

Get the browser name.
public browser ( $userAgent = null ) : string
return string

device() public method

Get the device name.
public device ( string $userAgent = null ) : string
$userAgent string
return string

findDetectionRulesAgainstUA() protected method

Match a detection rule and return the matched key.
protected findDetectionRulesAgainstUA ( array $rules, null $userAgent = null ) : string
$rules array
$userAgent null
return string

getDetectionRulesExtended() public method

Get all detection rules. These rules include the additional platforms and browsers.
public getDetectionRulesExtended ( ) : array
return array

getRules() public method

Retrieve the current set of rules.
public getRules ( ) : array
return array

isDesktop() public method

Check if the device is a desktop computer.
public isDesktop ( string $userAgent = null, array $httpHeaders = null ) : boolean
$userAgent string deprecated
$httpHeaders array deprecated
return boolean

isPhone() public method

Check if the device is a mobile phone.
public isPhone ( string $userAgent = null, array $httpHeaders = null ) : boolean
$userAgent string deprecated
$httpHeaders array deprecated
return boolean

isRobot() public method

Check if device is a robot.
public isRobot ( string $userAgent = null ) : boolean
$userAgent string
return boolean

languages() public method

Get accept languages.
public languages ( $acceptLanguage = null ) : array
return array

mergeRules() protected method

Merge multiple rules into one array.
protected mergeRules ( ) : array
return array

platform() public method

Get the platform name.
public platform ( string $userAgent = null ) : string
$userAgent string
return string

robot() public method

Get the robot name.
public robot ( string $userAgent = null ) : string
$userAgent string
return string

version() public method

Check the version of the given property in the User-Agent.
public version ( $propertyName, $type = self::VERSION_TYPE_STRING )

Property Details

$additionalBrowsers protected_oe static_oe property

Note: 'Vivaldi' must be above Chrome, otherwise it'll fail
protected static array $additionalBrowsers
return array

$additionalDevices protected_oe static_oe property

List of desktop devices.
protected static array $additionalDevices
return array

$additionalOperatingSystems protected_oe static_oe property

List of additional operating systems.
protected static array $additionalOperatingSystems
return array

$additionalProperties protected_oe static_oe property

List of additional properties.
protected static array $additionalProperties
return array

$robots protected_oe static_oe property

List of robots.
protected static array $robots
return array