CP_RULES
CP_RULES = 'cpr'
This class is used by the main API class and should not be used directly.
__construct( $tree)
$tree |
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
getRequiredProperties() : \The
Get a list of all the required properties that are needed for this class to properly run its rules.
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275list of required properties.
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 |
_initRuleSets(array $group) : \A
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()
array | $group | The current parent group. |
list of all rule sets
_init()
Initiliase some data structures to avoid doing it during requests
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275_initGetRulePropertyIds(array $sets)
Find all the properties that are used in the final rules. This is needed to optimise the Api.getProperty() function.
array | $sets | The rule set from the main rule group |
_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,}
_getRulesToRun()
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275
_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 |