UserAgent
in package
Abstraction for an HTTP user agent
Table of Contents
- $agent : string
- Current user-agent
- $browser : string
- Current user-agent browser
- $config : UserAgents
- Holds the config file contents.
- $isBrowser : bool
- Flag for if the user-agent belongs to a browser
- $isMobile : bool
- Flag for if the user-agent is a mobile browser
- $isRobot : bool
- Flag for if the user-agent is a robot
- $mobile : string
- Current user-agent mobile name
- $platform : string
- Current user-agent platform
- $referrer : mixed
- HTTP Referer
- $robot : string
- Current user-agent robot name
- $version : string
- Current user-agent version
- __construct() : mixed
- Constructor
- __toString() : string
- Outputs the original Agent String when cast as a string.
- getAgentString() : string
- Agent String
- getBrowser() : string
- Get Browser Name
- getMobile() : string
- Get the Mobile Device
- getPlatform() : string
- Get Platform
- getReferrer() : string
- Get the referrer
- getRobot() : string
- Get The Robot Name
- getVersion() : string
- Get the Browser Version
- isBrowser() : bool
- Is Browser
- isMobile() : bool
- Is Mobile
- isReferral() : bool
- Is this a referral from another site?
- isRobot() : bool
- Is Robot
- parse() : void
- Parse a custom user-agent string
- compileData() : void
- Compile the User Agent Data
- setBrowser() : bool
- Set the Browser
- setMobile() : bool
- Set the Mobile Device
- setPlatform() : bool
- Set the Platform
- setRobot() : bool
- Set the Robot
Properties
$agent
Current user-agent
protected
string
$agent
= ''
$browser
Current user-agent browser
protected
string
$browser
= ''
$config
Holds the config file contents.
protected
UserAgents
$config
$isBrowser
Flag for if the user-agent belongs to a browser
protected
bool
$isBrowser
= false
$isMobile
Flag for if the user-agent is a mobile browser
protected
bool
$isMobile
= false
$isRobot
Flag for if the user-agent is a robot
protected
bool
$isRobot
= false
$mobile
Current user-agent mobile name
protected
string
$mobile
= ''
$platform
Current user-agent platform
protected
string
$platform
= ''
$referrer
HTTP Referer
protected
mixed
$referrer
$robot
Current user-agent robot name
protected
string
$robot
= ''
$version
Current user-agent version
protected
string
$version
= ''
Methods
__construct()
Constructor
public
__construct([null|UserAgents $config = null ]) : mixed
Sets the User Agent and runs the compilation routine
Parameters
- $config : null|UserAgents = null
Return values
mixed —__toString()
Outputs the original Agent String when cast as a string.
public
__toString() : string
Return values
string —getAgentString()
Agent String
public
getAgentString() : string
Return values
string —getBrowser()
Get Browser Name
public
getBrowser() : string
Return values
string —getMobile()
Get the Mobile Device
public
getMobile() : string
Return values
string —getPlatform()
Get Platform
public
getPlatform() : string
Return values
string —getReferrer()
Get the referrer
public
getReferrer() : string
Return values
string —getRobot()
Get The Robot Name
public
getRobot() : string
Return values
string —getVersion()
Get the Browser Version
public
getVersion() : string
Return values
string —isBrowser()
Is Browser
public
isBrowser([string $key = null ]) : bool
Parameters
- $key : string = null
Return values
bool —isMobile()
Is Mobile
public
isMobile([string $key = null ]) : bool
Parameters
- $key : string = null
Return values
bool —isReferral()
Is this a referral from another site?
public
isReferral() : bool
Return values
bool —isRobot()
Is Robot
public
isRobot([string $key = null ]) : bool
Parameters
- $key : string = null
Return values
bool —parse()
Parse a custom user-agent string
public
parse(string $string) : void
Parameters
- $string : string
Return values
void —compileData()
Compile the User Agent Data
protected
compileData() : void
Return values
void —setBrowser()
Set the Browser
protected
setBrowser() : bool
Return values
bool —setMobile()
Set the Mobile Device
protected
setMobile() : bool
Return values
bool —setPlatform()
Set the Platform
protected
setPlatform() : bool
Return values
bool —setRobot()
Set the Robot
protected
setRobot() : bool