CP_RULES
CP_RULES = 'cpr'
This class is used by the main API class and should not be used directly.
propIsOutput(integer $propertyId) : TRUE
Check if the property is used in the rules and so can be found from them.
This is used in Api.getProperty() to avoid calling the methods in the class if the property that is being looked for cannot be found here.
integer | $propertyId | The ID of the property that is sought |
if the propertyId is used, FALSE otherwise
putProperties(string $clientSide)
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.
string | $clientSide |
_initGetMatcherPropertyIds(array $group)
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
array | $group | The rule group that can contain a property matcher |
_parseClientSideProperties( $clientSide) : \{key:
Parse the client side properties string into Map {key: value,} Sets to the tree.properties and returns the properties as Map (it is needed)
The clientSide is of the form: bjs.webGl:1|bjs.geoLocation:1|sdeviceAspectRatio:16/10|iusableDisplayHeight:1050 Each key:val part of clientSide is checked for sanity, if it looks not fine then that key:val will be ignored.
The first character of the property name is the type of the value.
$clientSide |
value,}
_checkPropertiesMatch( $propertyMatchers)
This functions checks all the properties in the property matcher branch of this rule group. This branch contains a list of properties, their values and an operator to use for comparison. All must match for this function to return true.
In reality the properties and values are indexes to the main property and value arrays.
$propertyMatchers |
_compareValues(string $detectedValue, string $expectedValue, string $operator, $propTypeName) : boolean
Compare two values that can be one of String, Boolean or Integer using the passed in operator.
string | $detectedValue | |
string | $expectedValue | |
string | $operator | |
$propTypeName |