Mobi_Mtld_DA_Device_Tree
in package
This class is used by the main API class and should not be used directly.
Tags
Table of Contents
- API_ID = '1'
- $config : mixed
- $lookupValue : mixed
- $stockUaHeaders : mixed
- $tree : mixed
- $cachedBooleanPropertyFalse : mixed
- $cachedBooleanPropertyTrue : mixed
- $clientProps : mixed
- $deviceIdPropNameId : mixed
- $jsonBatchDir : mixed
- the directory in which the json fragments are put
- $lookupPropType : mixed
- $MIN_JSON_VERSION : mixed
- $nicePropName : mixed
- $treeRegexes : mixed
- $uaProps : mixed
- $XMSG_CLIENT_PROPERTIES_NOT_SUPPORTED : mixed
- $XMSG_FILE_NOT_FOUND : mixed
- $XMSG_JSON_INVALID : mixed
- $XMSG_JSON_LOAD : mixed
- $XMSG_JSON_MISSING_REGEX_RULES : mixed
- $XMSG_JSON_VERSION : mixed
- $useTreeOptimizer : mixed
- __construct() : mixed
- Create the JSON tree handler.
- getDataCreationTimestamp() : mixed
- Get data file creation timestamp
- getDataRevision() : mixed
- getDataVersion() : mixed
- Get data file version
- getLookupSource() : string
- Get the source properties fetch source to be used for debugging.
- getPropertyNames() : mixed
- Get the list of all available property names from the tree (not contains client side props)
- loadTreeFromFile() : mixed
- Load the JSON tree file into the handler.
- loadTreeFromString() : mixed
- Load the JSON tree into the handler.
- putProperties() : mixed
- Get properties from tree walk/ua/client-side and put them in the tree.properties
- putTreeWalkProperties() : mixed
- Get properties from tree walk/ua and put them in the tree.properties
- setConfig() : mixed
- Set new config settings via a new Config object.
- sanitizeTree() : mixed
- seekProperties() : mixed
- Seek properties for a user agent within a node. This is designed to be recursed, and only externally called with the node representing the top of the tree
Constants
API_ID
public
mixed
API_ID
= '1'
Properties
$config
public
mixed
$config
= \null
$lookupValue
public
mixed
$lookupValue
= \true
$stockUaHeaders
public
mixed
$stockUaHeaders
= array('x-device-user-agent', 'x-original-user-agent', 'x-operamini-phone-ua', 'x-skyfire-phone', 'x-bolt-phone-ua', 'device-stock-ua', 'x-ucbrowser-ua', 'x-ucbrowser-device-ua', 'x-ucbrowser-device', 'x-puffin-ua')
$tree
public
mixed
$tree
= \null
$cachedBooleanPropertyFalse
protected
mixed
$cachedBooleanPropertyFalse
= \null
$cachedBooleanPropertyTrue
protected
mixed
$cachedBooleanPropertyTrue
= \null
$clientProps
protected
mixed
$clientProps
= \null
$deviceIdPropNameId
protected
mixed
$deviceIdPropNameId
$jsonBatchDir
the directory in which the json fragments are put
protected
mixed
$jsonBatchDir
$lookupPropType
protected
mixed
$lookupPropType
= \null
$MIN_JSON_VERSION
protected
static mixed
$MIN_JSON_VERSION
= 0.7
$nicePropName
protected
mixed
$nicePropName
= \null
$treeRegexes
protected
mixed
$treeRegexes
= \null
$uaProps
protected
mixed
$uaProps
= \null
$XMSG_CLIENT_PROPERTIES_NOT_SUPPORTED
protected
static mixed
$XMSG_CLIENT_PROPERTIES_NOT_SUPPORTED
= 'JSON data does not support Client-side properties.'
$XMSG_FILE_NOT_FOUND
protected
static mixed
$XMSG_FILE_NOT_FOUND
= 'Unable to read "%s" file, make sure file exists and has read permissions.'
$XMSG_JSON_INVALID
protected
static mixed
$XMSG_JSON_INVALID
= 'Bad data loaded into the tree.'
$XMSG_JSON_LOAD
protected
static mixed
$XMSG_JSON_LOAD
= 'Unable to load JSON data.'
$XMSG_JSON_MISSING_REGEX_RULES
protected
static mixed
$XMSG_JSON_MISSING_REGEX_RULES
= 'Missing regex rules.'
$XMSG_JSON_VERSION
protected
static mixed
$XMSG_JSON_VERSION
= 'This version of the API requires a newer version of the JSON data.'
$useTreeOptimizer
private
mixed
$useTreeOptimizer
= \null
Methods
__construct()
Create the JSON tree handler.
public
__construct(mixed $config) : mixed
Parameters
- $config : mixed
Return values
mixed —getDataCreationTimestamp()
Get data file creation timestamp
public
getDataCreationTimestamp() : mixed
Return values
mixed —getDataRevision()
public
getDataRevision() : mixed
Return values
mixed —getDataVersion()
Get data file version
public
getDataVersion() : mixed
Return values
mixed —getLookupSource()
Get the source properties fetch source to be used for debugging.
public
getLookupSource() : string
Return values
string —'tree' or 'optimized tree' or 'cache'
getPropertyNames()
Get the list of all available property names from the tree (not contains client side props)
public
getPropertyNames() : mixed
Return values
mixed —loadTreeFromFile()
Load the JSON tree file into the handler.
public
loadTreeFromFile(mixed $jsonDataFilePath) : mixed
Parameters
- $jsonDataFilePath : mixed
Tags
Return values
mixed —loadTreeFromString()
Load the JSON tree into the handler.
public
loadTreeFromString(mixed $json) : mixed
Parameters
- $json : mixed
Tags
Return values
mixed —putProperties()
Get properties from tree walk/ua/client-side and put them in the tree.properties
public
putProperties(mixed $userAgent, mixed $stockUserAgents, mixed $clientside, mixed &$properties) : mixed
Parameters
- $userAgent : mixed
- $stockUserAgents : mixed
- $clientside : mixed
- $properties : mixed
Return values
mixed —putTreeWalkProperties()
Get properties from tree walk/ua and put them in the tree.properties
public
putTreeWalkProperties(mixed $userAgent, mixed $stockUserAgents, mixed &$properties) : mixed
if stockUserAgents != null - iterate over stockUserAgents for each item: tree-walk and stop iteration if result has deviceId - use userAgent for detecting the ua-props
if stockUserAgents == null - use userAgent for tree walk - use userAgent for detecting the ua-props
Parameters
- $userAgent : mixed
- $stockUserAgents : mixed
- $properties : mixed
Return values
mixed —setConfig()
Set new config settings via a new Config object.
public
setConfig(type $config) : mixed
Parameters
- $config : type
Return values
mixed —sanitizeTree()
protected
sanitizeTree() : mixed
Tags
Return values
mixed —seekProperties()
Seek properties for a user agent within a node. This is designed to be recursed, and only externally called with the node representing the top of the tree
private
seekProperties(mixed $userAgent, mixed &$properties, mixed &$props2Vals) : mixed
Parameters
- $userAgent : mixed
- $properties : mixed
- $props2Vals : mixed