DeviceAtlas Device API
 All Classes Namespaces Functions Variables
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Mobi_Mtld_DA_UaProps Class Reference
Inheritance diagram for Mobi_Mtld_DA_UaProps:
Mobi_Mtld_DA_PostWalkRules

Public Member Functions

 __construct (&$tree)
 getProperties ($userAgent, $idProperties, $sought, $typedValues)
- Public Member Functions inherited from Mobi_Mtld_DA_PostWalkRules
 __construct (array &$tree, $type)
 propIsOutput ($propertyId)
 getRequiredProperties ()

Public Attributes

const UA_RULES = "uar"
const SKIP_IDS = "sk"
const REGEXES = "reg"
const DEFAULT_REGEX_SET = "d"
const REFINE_REGEX_ID = "f"
const SEARCH_REGEX_ID = "s"
const RULE_REGEX_ID = "r"
const REGEX_MATCH_POS = "m"
- Public Attributes inherited from Mobi_Mtld_DA_PostWalkRules
const RULE_GROUPS = "rg"
const PROPERTY_MATCHER = "p"
const PROPERTY = "p"
const PROPERTY_VALUE = "v"
const OPERATOR = "o"
const RULE_ARR = "r"
const RULE_PROP_IDS_IN_USE = "rpids"
const MATCHER_PROP_IDS_IN_USE = "mpids"
const RULE_SET = "t"
const RULE_SET_COUNT = "tc"

Protected Member Functions

 _initGetMatcherPropertyIds ($group, $propIds)
 _initRuleSets ($group)

Additional Inherited Members

- Protected Attributes inherited from Mobi_Mtld_DA_PostWalkRules
 $tree
 $branch
 $propertyNameToId
 $propertyIdToType

Detailed Description

This class is used by the main Api class and should not be used directly.

This class tries to extract properties from the User-Agent string itself. This is a completely separate step to the main JSON tree walk but uses the results of the tree walk to optimise the property extraction. The property extraction is done in two steps.

Step 1: Try and identify the type of User-Agent and thus the set of property extraction rules to run. This is optimised by the properties from the tree walk.

Step 2: Run the rules found in step 1 to try and extract the properties.

Author
dotMobi

Member Function Documentation

Mobi_Mtld_DA_UaProps::_initGetMatcherPropertyIds (   $group,
  $propIds 
)
protected

Find all the properties that are used for matching. This is needed in case the Api.getProperty() function is called as we need these properties for the User-Agent extraction rules to work correctly.

Parameters
array$groupThe rule group that can contain a property matcher
array$propIdsThe set of found property IDs to which new ones are added to
Returns
An updated set of property IDs

Reimplemented from Mobi_Mtld_DA_PostWalkRules.

Mobi_Mtld_DA_UaProps::_initRuleSets (   $group)
protected

Prepare the rule set by extracting it from the current group and counting the items in the group. This is done to avoid counting the items on every request.

Parameters
array$groupThe current parent group.
Returns
array A list of all rule sets

Reimplemented from Mobi_Mtld_DA_PostWalkRules.

Mobi_Mtld_DA_UaProps::getProperties (   $userAgent,
  $idProperties,
  $sought,
  $typedValues 
)

Get the User-Agent string properties using the User-Agent rules

Parameters
string$userAgentThe User-Agent to find properties for
array$idPropertiesThe results of the tree walk, map of property id to value id
array$soughtA set of properties to return values for
boolean$typedValuesWhether to return typed values or string values
Returns
array of properties or NULL if there are no properties

The documentation for this class was generated from the following file: