Constants

API_ID

API_ID = '1'

Properties

$stockUaHeaders

$stockUaHeaders : 

Type

$config

$config : 

Type

$tree

$tree : 

Type

$properties

$properties : 

Type

$lookupValue

$lookupValue : 

Type

$MIN_JSON_VERSION

$MIN_JSON_VERSION : 

Type

$XMSG_JSON_LOAD

$XMSG_JSON_LOAD : 

Type

$XMSG_JSON_VERSION

$XMSG_JSON_VERSION : 

Type

$XMSG_JSON_INVALID

$XMSG_JSON_INVALID : 

Type

$XMSG_JSON_MISSING_REGEX_RULES

$XMSG_JSON_MISSING_REGEX_RULES : 

Type

$XMSG_CLIENT_PROPERTIES_NOT_SUPPORTED

$XMSG_CLIENT_PROPERTIES_NOT_SUPPORTED : 

Type

$XMSG_FILE_NOT_FOUND

$XMSG_FILE_NOT_FOUND : 

Type

$treeRegexes

$treeRegexes : 

Type

$uaProps

$uaProps : 

Type

$clientProps

$clientProps : 

Type

$deviceIdPropNameId

$deviceIdPropNameId : 

Type

Methods

__construct()

__construct(  $config) 

Create the JSON tree handler.

Parameters

$config

setConfig()

setConfig(\type  $config) 

Set new config settings via a new Config object.

Parameters

\type $config

loadTreeFromFile()

loadTreeFromFile(  $jsonDataFilePath) 

Load the JSON tree file into the handler.

Parameters

$jsonDataFilePath

Throws

\Mobi_Mtld_DA_Exception_DataFileException
\Mobi_Mtld_DA_Exception_JsonException

loadTreeFromString()

loadTreeFromString(  $json) 

Load the JSON tree into the handler.

Parameters

$json

Throws

\Mobi_Mtld_DA_Exception_JsonException

getPropertyNames()

getPropertyNames() 

Get the list of all available property names from the tree (not contains client side props)

getDataVersion()

getDataVersion() 

Get data file version

getDataCreationTimestamp()

getDataCreationTimestamp() 

Get data file creation timestamp

getDataRevision()

getDataRevision() 

putProperties()

putProperties(  $userAgent,   $stockUserAgents,   $clientside) 

Get properties from tree walk/ua/client-side and put them in the tree.properties

Parameters

$userAgent
$stockUserAgents
$clientside

putTreeWalkProperties()

putTreeWalkProperties(  $userAgent,   $stockUserAgents = null) 

Get properties from tree walk/ua and put them in the tree.properties

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
$stockUserAgents

getLookupSource()

getLookupSource() : string

Get the source properties fetch source to be used for debugging.

Returns

string —

'tree' or 'optimized tree' or 'cache'

sanitizeTree()

sanitizeTree() 

Throws

\Mobi_Mtld_DA_Exception_JsonException

seekProperties()

seekProperties(  $node,   $string,   $props2Vals,   $matched,   $regexRules,   $exclusionKeysList) 

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

Parameters

$node
$string
$props2Vals
$matched
$regexRules
$exclusionKeysList

filterPropertiesResult()

filterPropertiesResult(  $props2Vals,   $exclusionKeysList) 

Filter properties if present in exclusion key list ('s' node).

Parameters

$props2Vals
$exclusionKeysList