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

Public Member Functions

 __construct (&$tree)
 getProperties ($detectedProperties, $clientProperties, $typedValues)
 getClientProperty ($propertyId, $propertyName, array $parsedCookie, $typedValues)
 parseClientSideProperties ($propStr, $typedValues)
- Public Member Functions inherited from Mobi_Mtld_DA_PostWalkRules
 __construct (array &$tree, $type)
 propIsOutput ($propertyId)
 getRequiredProperties ()

Static Public Member Functions

static propertyTypeCheck ($cookie, $property, $typePrefix)

Public Attributes

const CP_RULES = "cpr"
const USER_AGENT = "ua"
const OPERATOR_EQUALS = "="
const OPERATOR_NOT_EQUALS = "!="
const OPERATOR_LESS_THAN = "<"
const OPERATOR_LESS_THAN_EQUALS = "<="
const OPERATOR_GREATER_THAN = ">"
const OPERATOR_GREATER_THAN_EQUALS = ">="
const PROPERTY_NAME_ALLOWED_CHARS_PATTERN = '/^[a-z0-9.]+$/i'
- 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

Member Function Documentation

Mobi_Mtld_DA_ClientProps::_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 rules to work correctly

Parameters
array$groupsThe rule group that can contain a property matcher
array$propIdsThe set of found property IDs
Returns
An updated set of property IDs

Reimplemented from Mobi_Mtld_DA_PostWalkRules.

Mobi_Mtld_DA_ClientProps::_initRuleSets (   $group)
protected

Prepare the rule set by extracting it from the current group and wrapping it in an array. This is done to remain compatible with initGetRulePropertyIds()

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

Reimplemented from Mobi_Mtld_DA_PostWalkRules.

Mobi_Mtld_DA_ClientProps::getClientProperty (   $propertyId,
  $propertyName,
array  $parsedCookie,
  $typedValues 
)

Try and get a property from only the passed client cookie

Parameters
integer$propertyId
string$propertyName
array$parsedCookie
boolean$typedValues
Returns
array
Mobi_Mtld_DA_ClientProps::getProperties (   $detectedProperties,
  $clientProperties,
  $typedValues 
)

Merge the tree walk properties with the client side properties and run any additional rules based on the client side and tree walk properties. The rules can define replacement or additional values for properties and can also provide a new User-Agent to be used for a second tree walk. This is typically a fake User-Agent mapped to a device that cannot normally be detected such as the various iPhone models.

Parameters
array$detectedPropertiesThe results of the tree walk, map of property id to value id
array$clientProperties
boolean$typedValuesWhether to return typed values or string values
Returns
array of properties or NULL if there are no properties
Mobi_Mtld_DA_ClientProps::parseClientSideProperties (   $propStr,
  $typedValues 
)

Parse the client side properties and if typed values is set convert the values to the appropiate type.

The propStr is of the form: bjs.webGl:1|bjs.geoLocation:1|sdeviceAspectRatio:16/10|iusableDisplayHeight:1050

The first character of the property name is the type of the value.

Parameters
string$propStr
boolean$typedValues
Returns
array
Exceptions
Mobi_Mtld_Da_Exception_JsonException
static Mobi_Mtld_DA_ClientProps::propertyTypeCheck (   $cookie,
  $property,
  $typePrefix 
)
static

Check if a given property exists with a certain type. This follows the same logic as the Api::propertyTypeCheck() in that it really checks if a property exists and if it has the correct type.

Parameters
$cookieThe cookie string
$propertyThe property name to check
$typePrefixThe type of the property (s,b,i,d)

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