Mobi_Mtld_DA_Device_UaProps
extends Mobi_Mtld_DA_Device_PostWalkRules
in package
This class is used by the main API class and should not be used directly.
Tags
Table of Contents
- UA_RULES = 'uar'
- $branch : mixed
- $treeProvider : mixed
- $regexes : mixed
- $skipIDs : mixed
- __construct() : mixed
- putProperties() : mixed
- Merge the tree walk properties with the User-Agent string properties using the User-Agent rules
- _checkPropertiesMatch() : true
- This functions checks all the properties in the property matcher branch of this rule group. This branch contains a list of properties and their values.
- _extractProperties() : mixed
- This function loops over all the rules in rulesToRun and returns any properties that match. The properties returned can be typed or strings.
- _findRulesByProperties() : An
- Try and find User-Agent type and thus the rules to run by using the properties returned from the tree walk. All the properties defined in the property matcher set must match. If a match is found then the rules can be returned.
- _findRulesByRegex() : An
- Search for the rules to run by checking the User-Agent with a regex. If there is a match the rule list is returned.
- _findRulesToRunByRegex() : An
- Loop over a set of refining rules to try and determine the User-Agent type and so find the rules to run on it.
- _initProcessRegexes() : mixed
- Process the regexes by overriding any default ones with API specific regexes.
- _preProcessRules() : mixed
- _skipUaRules() : true
- Check list of items that skip rules - these are typically non-mobile boolean properties such as isBrowser, isBot, isCrawler etc
Constants
UA_RULES
public
mixed
UA_RULES
= 'uar'
Properties
$branch
protected
mixed
$branch
$treeProvider
protected
mixed
$treeProvider
$regexes
private
mixed
$regexes
$skipIDs
private
mixed
$skipIDs
Methods
__construct()
public
__construct(mixed $tree) : mixed
Parameters
- $tree : mixed
Return values
mixed —putProperties()
Merge the tree walk properties with the User-Agent string properties using the User-Agent rules
public
putProperties(string $userAgent, array<string|int, mixed> $props2Vals, mixed &$treeProperties) : mixed
Parameters
- $userAgent : string
-
The User-Agent to find properties for
- $props2Vals : array<string|int, mixed>
-
The results of the tree walk, map of property id to value id
- $treeProperties : mixed
Return values
mixed —_checkPropertiesMatch()
This functions checks all the properties in the property matcher branch of this rule group. This branch contains a list of properties and their values.
private
static _checkPropertiesMatch(array<string|int, mixed> $propList, array<string|int, mixed> $props2Vals) : true
All must match for this function to return true.
In reality the properties and values are indexes to the main property and value arrays.
Parameters
- $propList : array<string|int, mixed>
-
The list of properties to check for matches
- $props2Vals : array<string|int, mixed>
-
The results of the tree walk, map of property id to value id
Return values
true —if ALL properties match, false otherwise
_extractProperties()
This function loops over all the rules in rulesToRun and returns any properties that match. The properties returned can be typed or strings.
private
_extractProperties(array<string|int, mixed> $rulesToRun, string $userAgent, mixed &$treeProperties) : mixed
Parameters
- $rulesToRun : array<string|int, mixed>
-
The rules to run against the User-Agent to find the properties
- $userAgent : string
-
The User-Agent to find properties for
- $treeProperties : mixed
Return values
mixed —_findRulesByProperties()
Try and find User-Agent type and thus the rules to run by using the properties returned from the tree walk. All the properties defined in the property matcher set must match. If a match is found then the rules can be returned.
private
_findRulesByProperties(string $userAgent, array<string|int, mixed> $props2Vals) : An
Parameters
- $userAgent : string
-
The User-Agent to find properties for
- $props2Vals : array<string|int, mixed>
-
The results of the tree walk, map of property id to value id
Return values
An —array of rules to run against the User-Agent or NULL if no rules are found
_findRulesByRegex()
Search for the rules to run by checking the User-Agent with a regex. If there is a match the rule list is returned.
private
_findRulesByRegex(string $userAgent) : An
Parameters
- $userAgent : string
-
The User-Agent to find properties for
Return values
An —array of rules to run against the User-Agent or NULL if no rules are found
_findRulesToRunByRegex()
Loop over a set of refining rules to try and determine the User-Agent type and so find the rules to run on it.
private
_findRulesToRunByRegex(string $userAgent, array<string|int, mixed> $ruleSet, string $type) : An
Parameters
- $userAgent : string
-
The User-Agent to find properties for
- $ruleSet : array<string|int, mixed>
-
The ruleset that contains the search regex id, refine regex id and the magical rulesToRun
- $type : string
-
The type of rule to run either Refine or Search
Return values
An —array of rules to run against the User-Agent or NULL if no rules are found
_initProcessRegexes()
Process the regexes by overriding any default ones with API specific regexes.
private
_initProcessRegexes() : mixed
Return values
mixed —_preProcessRules()
private
_preProcessRules() : mixed
Return values
mixed —_skipUaRules()
Check list of items that skip rules - these are typically non-mobile boolean properties such as isBrowser, isBot, isCrawler etc
private
_skipUaRules(mixed $props2Vals) : true
Parameters
- $props2Vals : mixed
Return values
true —if the UA rules are to be skipped, FALSE if they are to be run