Documentation

DeviceDataParser
in package

Parses the data from the JSON file.

Tags
author

DeviceAtlas Limited

copyright

Copyright (c) DeviceAtlas Limited 2023. All Rights Reserved.

Table of Contents

Constants

CODE_POINT_DELIM  = "d"
COMPONENT_DYNAMIC_PROPERTIES  = "d"
COMPONENT_DYNAMIC_VALUE_EXTRACTOR_INDEX  = "e"
COMPONENT_DYNAMIC_VALUE_PRECEDING_COMPONENT_INDEX  = "i"
COMPONENT_END_VERSION  = "ev"
COMPONENT_ID  = "id"
COMPONENT_INHERIT_FROM_INDEX  = "i"
COMPONENT_PARENT_INDEX  = "p"
COMPONENT_PRECEDES_DYNAMIC_PROPERTY  = "pr"
COMPONENT_PROPERTY_VALUE  = "v"
COMPONENT_START_VERSION  = "sv"
COMPONENT_STOCK_CHILD_INDEX  = "s"
COMPONENT_STOCK_CHILD_INHERIT_DYNAMIC_PROPERTIES  = "sd"
COMPONENT_TYPE_ID  = "t"
COMPONENT_TYPE_INDEX  = "i"
COMPONENT_TYPE_LEVEL  = "l"
COMPONENT_TYPE_NAME_ABBREVIATION  = "a"
COMPONENT_TYPE_WEIGHT  = "w"
COMPONENT_TYPES  = "t"
COMPONENT_VERSION_SPECIFIC_CHILDREN  = "vc"
COMPONENT_VERSION_SPECIFIC_CHILDREN_COMPONENTS  = "c"
COMPONENT_VERSION_SPECIFIC_CHILDREN_MAX_VERSION_PARTS  = "m"
COMPONENT_VERSION_SPECIFIC_CHILDREN_PROPERTY_INDEX  = "p"
COMPONENT_WEIGHT  = "w"
COMPONENTS  = "c"
CONSTRAINT_GROUP_LOOKAROUND_CONSTRAINT  = "l"
CONSTRAINT_GROUPS  = "cg"
DIRECT_CHILD  = "c"
DYNAMIC_VALUE_EXTRACTOR_TYPE  = "t"
DYNAMIC_VALUE_EXTRACTORS  = "e"
INPUTS  = "i"
INPUTS_ENSURE_QUOTE  = "q"
INPUTS_IDENTIFIER_KEY  = "n"
INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES  = "id"
INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES_ASSOCIATED_INPUTS  = "a"
INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES_COMPONENT_TYPE_ID  = "t"
INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES_IDENTIFIER_INDEXES  = "i"
INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES_ORDERED_INPUTS  = "o"
INPUTS_LIST  = "l"
INPUTS_PROPERTY_MAPPINGS  = "pm"
INPUTS_PROPERTY_MAPPINGS_COMPARISON_TRANSFORMATION  = "ct"
INPUTS_PROPERTY_MAPPINGS_COMPARISON_TRANSFORMATION_COMPARISON_VALUE  = "c"
INPUTS_PROPERTY_MAPPINGS_COMPARISON_TRANSFORMATION_OPERATOR  = "o"
INPUTS_PROPERTY_MAPPINGS_COMPARISON_TRANSFORMATION_RETURN_VALUE  = "r"
INPUTS_PROPERTY_MAPPINGS_IDENTIFIER_ID  = "i"
INPUTS_PROPERTY_MAPPINGS_TRIM_TRANSFORMATION  = "tt"
INPUTS_PROPERTY_MAPPINGS_TRIM_TRANSFORMATION_PREFIX_TRIM  = "b"
INPUTS_PROPERTY_MAPPINGS_TRIM_TRANSFORMATION_SUFFIX_TRIM  = "a"
INPUTS_SOURCE  = "s"
JSON_DATA_TYPE_BOOLEAN  = 'b'
JSON_DATA_TYPE_INTEGER  = 'i'
JSON_DATA_TYPE_STRING  = 's'
LOOKAROUND_CONSTRAINT_MAX_OFFSET  = "x"
LOOKAROUND_CONSTRAINT_MIN_OFFSET  = "n"
LOOKAROUND_CONSTRAINT_TO_FIND_COMPONENT_INDEX  = "i"
MATCH_CANDIDATE_ADDITIONAL_ACTIONS  = "a"
MATCH_CANDIDATE_ADDITIONAL_ACTIONS_COMPONENT_TYPES_TO_REMOVE  = "r"
MATCH_CANDIDATE_COMPONENT_INDEX  = "i"
MATCH_CANDIDATE_CONSTRAINT_GROUP  = "g"
MATCH_CANDIDATE_LOOKAROUND_CONSTRAINT  = "l"
MATCH_CANDIDATE_MATCH_CONSTRAINT  = "ct"
MATCH_CANDIDATE_MATCH_TYPE  = "t"
MATCH_CANDIDATE_POSITION_CONSTRAINT  = "p"
MATCH_CANDIDATE_PROPERTY_CONSTRAINTS  = "pr"
MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES  = "c"
MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES_OPERATOR  = "o"
MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES_PROPERTY  = "p"
MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES_TYPE  = "c"
MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES_VALUE  = "v"
MATCH_CANDIDATES  = "m"
META  = "\$"
META_CASE  = "case"
META_CREATED  = "created"
META_VERSION  = "version"
MIN_DATA_VERSION  = 3.0
POSITION_CONSTRAINT_MAX_POS  = "x"
POSITION_CONSTRAINT_MIN_POS  = "n"
PROPERTY_NAME  = "n"
PROPERTY_NAMES  = "p"
PROPERTY_TYPE  = "t"
PROPERTY_VALUES  = "v"
SW_ALLOWED_ANY_MATCH  = "sw"
TOKEN_START_CHILD  = "t"
TOKEN_TRIE  = "tr"
XMSG_JSON_INVALID  = "Invalid device data file."
XMSG_JSON_VERSION  = "This version of the API requires a newer version of the data file."

Properties

$components  : mixed
$componentToVersionSpecificChildren  : mixed
$constraintGroups  : mixed
$delimitersHandler  : mixed
$dynamicValueExtractors  : mixed
$idToComponentType  : mixed
$inputs  : mixed
$json  : mixed
$maxComponentTypeId  : mixed
$maxStockChildLevel  : mixed
$metaData  : mixed
$propertyDataTypes  : mixed
$propertyNames  : mixed
$propertyValueCache  : mixed
$propertyValueCacheBooleans  : mixed
$propertyValues  : mixed
$stockChildIndexesInheritDynamicProperties  : mixed
$tokenTrie  : mixed

Methods

__construct()  : mixed
getDataTypeId()  : mixed
Get data type id by data type character from JSON "s", "b", "i".
parse()  : DeviceData
Parse and prepare the device data from the JSON.
checkComponent()  : mixed
extractComparisonTransformer()  : mixed
extractComparisonTransformers()  : mixed
extractComponents()  : array<string|int, array<string|int, mixed>>
Extracts the components. A Component may reference parent or inheritFrom Components. To handle this, all components are loaded and the component index for the parent and inheritFrom is recorded. A second pass over the components converts the index into an actual component.
extractIdentifierByComponentType()  : mixed
extractIdentifiersByComponentType()  : mixed
Extract an ordered list of identifiers by component type:
extractInput()  : mixed
extractInputs()  : array<string|int, mixed>
Extracts the ordered list of inputs to use for Token Detection.
extractPropertyMappings()  : mixed
Extracts an array of property mapping objects to assign identifier values to DeviceAtlas properties.
extractPropertyMappingSource()  : mixed
extractPropertyMappingSources()  : mixed
extractRootInputs()  : Inputs
Extracts the inputs that are used for device detection. The inputs consists of a set of identifiers and property mappings:
extractTrimTransformer()  : mixed
getAdditionalActions()  : mixed
Extracts the match constraints additional actions
getCodePointDelimiters()  : DelimitersHandler
The delimiter codepoints are an array of integers.
getComparisonProperties()  : mixed
A comparison property is comprised of a property/value pair and an operator.
getComparisonProperty()  : mixed
getComponent()  : Component
A component has the following fields:
getComponentDynamicProperties()  : array<string|int, mixed>
The Dynamic Properties for a component is a Map of property name ID to an array of DynamicValues. Each Dynamic Value defines a component that must exist before the dynamic value and the dynamic value extractor.
getComponentDynamicValue()  : DynamicValue
Get the DynamicValue object. This has the structure of:
getComponentDynamicValuesArray()  : array<string|int, mixed>
A component may have properties that are populated dynamically at runtime.
getComponentPropertyValues()  : array<string|int, mixed>
Gets the property/values for a component. The returned Map uses the property name ID as the key. The property/values have the following structure:
getComponentsToReplace()  : mixed
getComponentTypeById()  : mixed
getComponentTypes()  : array<string|int, mixed>
The component types is an array of component type objects. Example structure:
getConstraintGroup()  : mixed
[ Match Constraint (array of Lookaround Constraints), Match Constraint, ... ...More match constraint ]
getConstraintGroups()  : array<string|int, mixed>
Get the (optional) list of Constraint Groups. A match candidate that has a Constraint Group references it via the list index.
getConstraints()  : array<string|int, mixed>
Get the match candidate constraints. Constraints have the following structure.
getDependentIdentifier()  : mixed
getDependentIdentifiers()  : mixed
Extracts the array of dependent identifiers:
getDynamicValueExtractors()  : array<string|int, mixed>
Get the dynamic value extractors. This is an array of unique extractors with the structure:
getLookaroundConstraint()  : LookaroundConstraint
Gets a LookaroundConstraint object. These have the following structure:
getLookaroundConstraints()  : array<string|int, mixed>
The lookaround constraints with structure:
getMatchCandidate()  : MatchCandidate
A match candidate has the following structure:
getMatchCandidates()  : array<string|int, mixed>|null
Get the Match Candidates for token match in the Trie. This has the structure:
getMatchConstraint()  : mixed
{ "l": [ (l == Lookaround Constraint [optional]) { "i": 0, (i == To Find Component Index [mandatory]) "n": 0, (n == Min Offset [mandatory]) "x": 0 (x == Max Offset [mandatory]) }, ...more lookaround constraints ] }
getMetaData()  : MetaData
Parse the file meta data.
getPositionConstraint()  : mixed
The position constraint with structure:
getPropertiesAsPropertyNameObjects()  : array<string|int, mixed>
Get the Property Names. Note the order of the names is critical. They are referenced by index in other parts of the data file.
getPropertyConstraint()  : PropertyConstraint
Each property constraint is comprised of the following:
getPropertyConstraints()  : array<string|int, mixed>
Extracts the property constraints for a match candidate.
getPropertyDataTypes()  : mixed
getPropertyName()  : PropertyName
Get an individual property name from the following stucture:
getPropertyNames()  : mixed
getPropertyValue()  : mixed
getTokenTrie()  : mixed
Extract the Token Trie that is used for matching the tokens of incoming identifiers and returning matched components.
getVersionedSpecificChildren()  : VersionSpecificChildren
Extract the version-specific children:
traverse()  : mixed
Traverse the JSON structure and create the Trie of Nodes for the token start and direct child nodes.

Constants

COMPONENT_DYNAMIC_PROPERTIES

public mixed COMPONENT_DYNAMIC_PROPERTIES = "d"

COMPONENT_DYNAMIC_VALUE_EXTRACTOR_INDEX

public mixed COMPONENT_DYNAMIC_VALUE_EXTRACTOR_INDEX = "e"

COMPONENT_DYNAMIC_VALUE_PRECEDING_COMPONENT_INDEX

public mixed COMPONENT_DYNAMIC_VALUE_PRECEDING_COMPONENT_INDEX = "i"

COMPONENT_INHERIT_FROM_INDEX

public mixed COMPONENT_INHERIT_FROM_INDEX = "i"

COMPONENT_PRECEDES_DYNAMIC_PROPERTY

public mixed COMPONENT_PRECEDES_DYNAMIC_PROPERTY = "pr"

COMPONENT_STOCK_CHILD_INDEX

public mixed COMPONENT_STOCK_CHILD_INDEX = "s"

COMPONENT_STOCK_CHILD_INHERIT_DYNAMIC_PROPERTIES

public mixed COMPONENT_STOCK_CHILD_INHERIT_DYNAMIC_PROPERTIES = "sd"

COMPONENT_TYPE_NAME_ABBREVIATION

public mixed COMPONENT_TYPE_NAME_ABBREVIATION = "a"

COMPONENT_VERSION_SPECIFIC_CHILDREN

public mixed COMPONENT_VERSION_SPECIFIC_CHILDREN = "vc"

COMPONENT_VERSION_SPECIFIC_CHILDREN_COMPONENTS

public mixed COMPONENT_VERSION_SPECIFIC_CHILDREN_COMPONENTS = "c"

COMPONENT_VERSION_SPECIFIC_CHILDREN_MAX_VERSION_PARTS

public mixed COMPONENT_VERSION_SPECIFIC_CHILDREN_MAX_VERSION_PARTS = "m"

COMPONENT_VERSION_SPECIFIC_CHILDREN_PROPERTY_INDEX

public mixed COMPONENT_VERSION_SPECIFIC_CHILDREN_PROPERTY_INDEX = "p"

CONSTRAINT_GROUP_LOOKAROUND_CONSTRAINT

public mixed CONSTRAINT_GROUP_LOOKAROUND_CONSTRAINT = "l"

DYNAMIC_VALUE_EXTRACTOR_TYPE

public mixed DYNAMIC_VALUE_EXTRACTOR_TYPE = "t"

INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES

public mixed INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES = "id"

INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES_ASSOCIATED_INPUTS

public mixed INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES_ASSOCIATED_INPUTS = "a"

INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES_COMPONENT_TYPE_ID

public mixed INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES_COMPONENT_TYPE_ID = "t"

INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES_IDENTIFIER_INDEXES

public mixed INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES_IDENTIFIER_INDEXES = "i"

INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES_ORDERED_INPUTS

public mixed INPUTS_IDENTIFIERS_BY_COMPONENT_TYPES_ORDERED_INPUTS = "o"

INPUTS_PROPERTY_MAPPINGS_COMPARISON_TRANSFORMATION

public mixed INPUTS_PROPERTY_MAPPINGS_COMPARISON_TRANSFORMATION = "ct"

INPUTS_PROPERTY_MAPPINGS_COMPARISON_TRANSFORMATION_COMPARISON_VALUE

public mixed INPUTS_PROPERTY_MAPPINGS_COMPARISON_TRANSFORMATION_COMPARISON_VALUE = "c"

INPUTS_PROPERTY_MAPPINGS_COMPARISON_TRANSFORMATION_OPERATOR

public mixed INPUTS_PROPERTY_MAPPINGS_COMPARISON_TRANSFORMATION_OPERATOR = "o"

INPUTS_PROPERTY_MAPPINGS_COMPARISON_TRANSFORMATION_RETURN_VALUE

public mixed INPUTS_PROPERTY_MAPPINGS_COMPARISON_TRANSFORMATION_RETURN_VALUE = "r"

INPUTS_PROPERTY_MAPPINGS_IDENTIFIER_ID

public mixed INPUTS_PROPERTY_MAPPINGS_IDENTIFIER_ID = "i"

INPUTS_PROPERTY_MAPPINGS_TRIM_TRANSFORMATION

public mixed INPUTS_PROPERTY_MAPPINGS_TRIM_TRANSFORMATION = "tt"

INPUTS_PROPERTY_MAPPINGS_TRIM_TRANSFORMATION_PREFIX_TRIM

public mixed INPUTS_PROPERTY_MAPPINGS_TRIM_TRANSFORMATION_PREFIX_TRIM = "b"

INPUTS_PROPERTY_MAPPINGS_TRIM_TRANSFORMATION_SUFFIX_TRIM

public mixed INPUTS_PROPERTY_MAPPINGS_TRIM_TRANSFORMATION_SUFFIX_TRIM = "a"

LOOKAROUND_CONSTRAINT_MAX_OFFSET

public mixed LOOKAROUND_CONSTRAINT_MAX_OFFSET = "x"

LOOKAROUND_CONSTRAINT_MIN_OFFSET

public mixed LOOKAROUND_CONSTRAINT_MIN_OFFSET = "n"

LOOKAROUND_CONSTRAINT_TO_FIND_COMPONENT_INDEX

public mixed LOOKAROUND_CONSTRAINT_TO_FIND_COMPONENT_INDEX = "i"

MATCH_CANDIDATE_ADDITIONAL_ACTIONS

public mixed MATCH_CANDIDATE_ADDITIONAL_ACTIONS = "a"

MATCH_CANDIDATE_ADDITIONAL_ACTIONS_COMPONENT_TYPES_TO_REMOVE

public mixed MATCH_CANDIDATE_ADDITIONAL_ACTIONS_COMPONENT_TYPES_TO_REMOVE = "r"

MATCH_CANDIDATE_COMPONENT_INDEX

public mixed MATCH_CANDIDATE_COMPONENT_INDEX = "i"

MATCH_CANDIDATE_CONSTRAINT_GROUP

public mixed MATCH_CANDIDATE_CONSTRAINT_GROUP = "g"

MATCH_CANDIDATE_LOOKAROUND_CONSTRAINT

public mixed MATCH_CANDIDATE_LOOKAROUND_CONSTRAINT = "l"

MATCH_CANDIDATE_MATCH_CONSTRAINT

public mixed MATCH_CANDIDATE_MATCH_CONSTRAINT = "ct"

MATCH_CANDIDATE_MATCH_TYPE

public mixed MATCH_CANDIDATE_MATCH_TYPE = "t"

MATCH_CANDIDATE_POSITION_CONSTRAINT

public mixed MATCH_CANDIDATE_POSITION_CONSTRAINT = "p"

MATCH_CANDIDATE_PROPERTY_CONSTRAINTS

public mixed MATCH_CANDIDATE_PROPERTY_CONSTRAINTS = "pr"

MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES

public mixed MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES = "c"

MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES_OPERATOR

public mixed MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES_OPERATOR = "o"

MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES_PROPERTY

public mixed MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES_PROPERTY = "p"

MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES_TYPE

public mixed MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES_TYPE = "c"

MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES_VALUE

public mixed MATCH_CANDIDATE_PROPERTY_CONSTRAINTS_COMPARISON_PROPERTIES_VALUE = "v"

POSITION_CONSTRAINT_MAX_POS

public mixed POSITION_CONSTRAINT_MAX_POS = "x"

POSITION_CONSTRAINT_MIN_POS

public mixed POSITION_CONSTRAINT_MIN_POS = "n"

XMSG_JSON_INVALID

public mixed XMSG_JSON_INVALID = "Invalid device data file."

XMSG_JSON_VERSION

public mixed XMSG_JSON_VERSION = "This version of the API requires a newer version of the data file."

Properties

$componentToVersionSpecificChildren

private mixed $componentToVersionSpecificChildren = []

$propertyValueCacheBooleans

private mixed $propertyValueCacheBooleans = []

$stockChildIndexesInheritDynamicProperties

private mixed $stockChildIndexesInheritDynamicProperties = []

Methods

__construct()

public __construct(mixed $data) : mixed
Parameters
$data : mixed

getDataTypeId()

Get data type id by data type character from JSON "s", "b", "i".

public static getDataTypeId(mixed $type) : mixed
Parameters
$type : mixed

parse()

Parse and prepare the device data from the JSON.

public parse() : DeviceData

{ "$": [object] $==Meta data [mandatory] "p": [array] p==Property names [mandatory] "v": [array] v==Values [mandatory] "d": [array] d==Codepoint delimiters [mandatory] "t": [array] t==Component Types [mandatory] "e": [array] e==Dynamic value extractors [optional] "cg": [array] cg==Constraint Groups [optional] "c": [array] c==Components [mandatory] "tr":[Object] tr==Token Trie [mandatory] "i": [array] i==Inputs [mandatory] }

IMPORTANT: The above keys are ordered by the JSON Generator to be in a predictable and optimal order. This is helpful as certain objects are required by other objects which are loaded later.

Tags
throws
JsonException
Return values
DeviceData

checkComponent()

private checkComponent(mixed $componentIndex, mixed &$jsonComponent) : mixed
Parameters
$componentIndex : mixed
$jsonComponent : mixed

extractComparisonTransformer()

private extractComparisonTransformer(mixed $propertyDataTypeId, mixed $jsonComparisonTransformer) : mixed
Parameters
$propertyDataTypeId : mixed
$jsonComparisonTransformer : mixed

extractComparisonTransformers()

private extractComparisonTransformers(mixed $propertyDataTypeId, mixed $jsonInputsPropertyMappingsComparisonTransformation) : mixed
Parameters
$propertyDataTypeId : mixed
$jsonInputsPropertyMappingsComparisonTransformation : mixed

extractComponents()

Extracts the components. A Component may reference parent or inheritFrom Components. To handle this, all components are loaded and the component index for the parent and inheritFrom is recorded. A second pass over the components converts the index into an actual component.

private extractComponents() : array<string|int, array<string|int, mixed>>

The components have the following structure:

[ {component object}, {component object}, ... {component object} ]

The index of each Component in the array is very important. It is used as a lookup to get a Component when creating the Token Trie and other objects.

Tags
throws
JsonException
Return values
array<string|int, array<string|int, mixed>>

extractIdentifierByComponentType()

private extractIdentifierByComponentType(mixed $inputs, mixed &$identifiersByComponentType, mixed $jsonInputsIdentifier) : mixed
Parameters
$inputs : mixed
$identifiersByComponentType : mixed
$jsonInputsIdentifier : mixed

extractIdentifiersByComponentType()

Extract an ordered list of identifiers by component type:

private extractIdentifiersByComponentType(mixed $inputs, mixed $jsonInputsIdentifiersByComponentTypes) : mixed

"id": [ { (id == identifiers by type) "t": integer, (t == component type index [mandatory]) "i":[integer array], (i == input indexes [mandatory]) "o":[{input-object}] (o == ordered inputs [mandatory]) }, … more identifier by type objects ]

Parameters
$inputs : mixed
$jsonInputsIdentifiersByComponentTypes : mixed

extractInput()

private extractInput(mixed $jsonInput) : mixed
Parameters
$jsonInput : mixed

extractInputs()

Extracts the ordered list of inputs to use for Token Detection.

private extractInputs( $jsonInputsList) : array<string|int, mixed>

This has the structure:

"l": [ (l == identifier list) { (index== 0, referenced by other objects) "n": string, (n == identifier key [mandatory]) "s": string, (s == source(s) h==HTTP, c==Client side JS [mandatory]) "q": boolean, (q == if true, ensure source value is CH double quoted. },

Parameters
$jsonInputsList :
Return values
array<string|int, mixed>

extractPropertyMappings()

Extracts an array of property mapping objects to assign identifier values to DeviceAtlas properties.

private extractPropertyMappings(mixed $inputs, mixed $jsonInputsPropertyMappings) : mixed

"pm": [ (p == property mappings) { "integer": (key is the DA property name id [mandatory]) [ (array of sources for this DA property) {"i":integer, (i == input index (from above) [mandatory]) // one of: "tt":{ (tr == trim transformation) [optional]) "b":string, (b == before characters to remove) "a":string, (a == after characters to remove) }

 // or:
   "ct":{[              (ct == comparison transformation)    [optional])
        "o":"string",   (o == operator, e.g. “=” or “!=”)
        "c":"string",   (c == comparison value, e.g. “?1”)
        "r":integer     (r == return value, index into value array)
      },
       … optionally more comparisons
      ]
    }
]}

… optionally more sources for this DA property

}, … more property mapping objects ]

Parameters
$inputs : mixed
$jsonInputsPropertyMappings : mixed
Tags
throws
JsonException

extractPropertyMappingSource()

private extractPropertyMappingSource(mixed $inputs, mixed $propertyDataTypeId, mixed $jsonPropertyMappingSource) : mixed
Parameters
$inputs : mixed
$propertyDataTypeId : mixed
$jsonPropertyMappingSource : mixed

extractPropertyMappingSources()

private extractPropertyMappingSources(mixed $inputs, mixed $propertyDataTypeId, mixed $jsonPropertyMappingSources) : mixed
Parameters
$inputs : mixed
$propertyDataTypeId : mixed
$jsonPropertyMappingSources : mixed

extractRootInputs()

Extracts the inputs that are used for device detection. The inputs consists of a set of identifiers and property mappings:

private extractRootInputs() : Inputs

"i": { (i == inputs [root level] [mandatory]) "l": [array of objects], (l == input list [mandatory]) "id": [array of objects], (id == identifiers by component type[mandatory]) "pm": [array of objects] (p == property mappings [mandatory]) }

Tags
throws
JsonException
Return values
Inputs

extractTrimTransformer()

private extractTrimTransformer(mixed $jsonInputsPropertyMappingsTrimTransformation) : mixed
Parameters
$jsonInputsPropertyMappingsTrimTransformation : mixed

getAdditionalActions()

Extracts the match constraints additional actions

private getAdditionalActions(mixed $jsonAdditionalActions) : mixed

{ "r": { (r == to remove/replace [optional]) "numeric-string": integer|null, (key=component type id, value=component idx or null) ... component type/components } }

Parameters
$jsonAdditionalActions : mixed

getComparisonProperties()

A comparison property is comprised of a property/value pair and an operator.

private getComparisonProperties(mixed $jsonComparisonProperties) : mixed

{ "p": integer, (p == property name id [mandatory]) "o": "string", (o == operator [mandatory]) "v": integer, (v == value id [mandatory]) "c": "string", (c == compare as [mandatory]) }

Parameters
$jsonComparisonProperties : mixed
Tags
throws
JsonException

getComparisonProperty()

private getComparisonProperty(mixed $jsonComparisonProperty) : mixed
Parameters
$jsonComparisonProperty : mixed

getComponent()

A component has the following fields:

private getComponent( $componentIndex,  $jsonComponent) : Component

{ "t":int, t==Component Type ID [mandatory] "w":byte w==Weight, defaults to 0 [optional] "p":int p==Parent Component Index, defaults to null [optional] "i":int p==Inherit From Component Index, defaults to null [optional] "s":int s==Stock child Component Index, defaults to null [optional] "v":{object}, v==Property values, defaults to null [optional] "pr":boolean pr==Precedes Dynamic Value, defaults to false [optional] "d":{object} d==Dynamic Property rules, defaults to null [optional] "sd":boolean sd==StockChild Can Inherit Dynamic Properties, defaults to false [optional] "cs":[array] cs==Client-side rules [optional] "vc":{object} vc==Version-specific Children [optional] "sv":string sv==Start Version [optional] "ev":string ev==End Version [optional] }

Parameters
$componentIndex :
$jsonComponent :
Tags
throws
JsonException
Return values
Component

getComponentDynamicProperties()

The Dynamic Properties for a component is a Map of property name ID to an array of DynamicValues. Each Dynamic Value defines a component that must exist before the dynamic value and the dynamic value extractor.

private getComponentDynamicProperties(array<string|int, mixed> $jsonComponentDynamicProperties) : array<string|int, mixed>

have the following structure:

{ "integer-string": [array of objects], ==> "propertyNameId": [{dynamicValueObj}] ..... "integer-string": [] }

Parameters
$jsonComponentDynamicProperties : array<string|int, mixed>
Tags
throws
JsonException
Return values
array<string|int, mixed>

of Property Name ID to DynamicValue[]

getComponentDynamicValue()

Get the DynamicValue object. This has the structure of:

private getComponentDynamicValue( $jsonComponentDynamicValues) : DynamicValue

{ "i":integer, i==Index of Component preceding a dynamic value "e":integer e==Index of Dynamic Value Extractor }

Parameters
$jsonComponentDynamicValues :
Tags
throws
JsonException
Return values
DynamicValue

getComponentDynamicValuesArray()

A component may have properties that are populated dynamically at runtime.

private getComponentDynamicValuesArray( $jsonComponentDynamicValuesArray) : array<string|int, mixed>

Each dynamic property may have one or more dynamic value extractors associated to it. This is to handle the case where there may be multiple possible values present. The order of the extractors defines the priority. For example,

User-Agent: Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.9.168 Version/11.50

Property Name: browserVersion ==> the version string may be present either after "Opera" or after "Version" if the "Version" token is present. The property therefore needs two dynamic value extractors associated with it.

extractor 1: value after Opera
extractor 2: value after Version (if it is present)

The dynamic values for a given property within a component have the following structure:

"prop_name_id": [{"i":integer, i==Index of Component preceding a dynamic value [mandatory] "e":integer e==Index of Dynamic Value Extractor [mandatory] }, ...]

Parameters
$jsonComponentDynamicValuesArray :
Tags
throws
JsonException
Return values
array<string|int, mixed>

getComponentPropertyValues()

Gets the property/values for a component. The returned Map uses the property name ID as the key. The property/values have the following structure:

private getComponentPropertyValues( $jsonComponentPropertyValue) : array<string|int, mixed>

{ "integer-string":integer, ==> "propertyNameId":propertyValueId ... "integer-string":integer }

Parameters
$jsonComponentPropertyValue :
Return values
array<string|int, mixed>

getComponentsToReplace()

private getComponentsToReplace(mixed $jsonComponentTypesToRemove) : mixed
Parameters
$jsonComponentTypesToRemove : mixed

getComponentTypeById()

private getComponentTypeById(mixed $componentTypeId) : mixed
Parameters
$componentTypeId : mixed

getComponentTypes()

The component types is an array of component type objects. Example structure:

private getComponentTypes() : array<string|int, mixed>

[ { "i": short, i==Component Type ID "a": string, a==Single char name abbreviation (e.g. b=browser, a=app etc) "l": integer, l==Component type level "w": integer w==Component type weight }, .... ]

All fields are mandatory.

Tags
throws
JsonException
Return values
array<string|int, mixed>

getConstraintGroup()

[ Match Constraint (array of Lookaround Constraints), Match Constraint, ... ...More match constraint ]

private getConstraintGroup(mixed $jsonConstraintGroup) : mixed
Parameters
$jsonConstraintGroup : mixed

getConstraintGroups()

Get the (optional) list of Constraint Groups. A match candidate that has a Constraint Group references it via the list index.

private getConstraintGroups() : array<string|int, mixed>

[ {Constraint Group object}, {Constraint Group object}, ... {Constraint Group object} ]

Tags
throws
JsonException
Return values
array<string|int, mixed>

getConstraints()

Get the match candidate constraints. Constraints have the following structure.

private getConstraints(mixed $jsonMatchCandidateMatchConstraint) : array<string|int, mixed>

Either one or both constraints will be set if constraints exist for a match candidate.

{ "p":{object}, p==Position Constraint [optional] "l":[array] l==Lookaround Constraints [optional] "g":integer g=Constraint Group index [optional] }

Parameters
$jsonMatchCandidateMatchConstraint : mixed
Tags
throws
JsonException
Return values
array<string|int, mixed>

getDependentIdentifier()

private getDependentIdentifier(mixed $inputs, mixed $jsonDependentIdentifier) : mixed
Parameters
$inputs : mixed
$jsonDependentIdentifier : mixed

getDependentIdentifiers()

Extracts the array of dependent identifiers:

private getDependentIdentifiers(mixed $inputs, mixed $jsonDependentIdentifiers) : mixed

"o":[ (o == ordered inputs [mandatory])

 {
   "i": integer,         (i == identifier input index         [mandatory])
   "a": [integer array]  (a == associated inputs              [optional])
 },
 … more input objects …

],

Parameters
$inputs : mixed
$jsonDependentIdentifiers : mixed

getDynamicValueExtractors()

Get the dynamic value extractors. This is an array of unique extractors with the structure:

private getDynamicValueExtractors() : array<string|int, mixed>

[ {Dynamic value object}, ... ]

Each Dynamic Value extractor has three possible forms with a common extractor type field in each:

{ "t":"s|v|r", t==Extractor Type ...other fields... }

The "other" fields depend on the type as follows:

"String" type: { "t":"s", t==Extractor Type, s==String Type [mandatory] "db":[integer array], db==Delimiters before (codepoints) [optional] "da":[integer array] da==Delimiters after (codepoints) [optional] }

"Version" type: { "t":"v", t==Extractor Type, s==Version Type [mandatory] "db": [integer array], db==Delimiters before (codepoints) [optional] "p": "string", p==Version Prefix [optional] "k": true|false, k==Keep Prefix [optional] "ds":"char", ds==Decimal Separator [mandatory] "a": true|false, a==Suffix Allowed [mandatory] "ss":"char", ss==Suffix Separator [optional] "da":[integer array] da==Delimiters after (codepoints) [optional] }

"Regex" type: { "t":"r", t==Extractor Type, s==Regex Type [mandatory] "d":"regex string", d==Default Regex [mandatory] "o":{"API_ID":"override regex} o==API Specific Regex override [optional] }

Tags
throws
JsonException
Return values
array<string|int, mixed>

getLookaroundConstraint()

Gets a LookaroundConstraint object. These have the following structure:

private getLookaroundConstraint(mixed $jsonLookaroundConstraint) : LookaroundConstraint

{ "i": integer, i==To Find Component Index [mandatory] "n": integer, n==Min offset (positive or negative integer) [mandatory] "x": integer x==Max offset (positive or negative integer) [mandatory] },

Parameters
$jsonLookaroundConstraint : mixed
Return values
LookaroundConstraint

getLookaroundConstraints()

The lookaround constraints with structure:

private getLookaroundConstraints(mixed $jsonConstraintGroupLookaroundConstraint) : array<string|int, mixed>

[ {lookaround constraint}, .... ]

Parameters
$jsonConstraintGroupLookaroundConstraint : mixed
Tags
throws
JsonException
Return values
array<string|int, mixed>

getMatchCandidate()

A match candidate has the following structure:

private getMatchCandidate( $jsonMatchCandidates) : MatchCandidate

{ "i": integer, i==Component Index [mandatory] "t": "eq"|"sw", r==Match Type (defaults to EQUALS if missing) [optional] "ct": {constraints} ct==Constraints (see constraints section) [optional] "g": integer g==Constraint Group Index [optional] }

Parameters
$jsonMatchCandidates :
Tags
throws
JsonException
Return values
MatchCandidate

getMatchCandidates()

Get the Match Candidates for token match in the Trie. This has the structure:

private getMatchCandidates( $jsonMatchCandidates) : array<string|int, mixed>|null

[ {match candidate}, {match candidate}, ... {match candidate}, ]

Parameters
$jsonMatchCandidates :
Tags
throws
JsonException
Return values
array<string|int, mixed>|null

getMatchConstraint()

{ "l": [ (l == Lookaround Constraint [optional]) { "i": 0, (i == To Find Component Index [mandatory]) "n": 0, (n == Min Offset [mandatory]) "x": 0 (x == Max Offset [mandatory]) }, ...more lookaround constraints ] }

private getMatchConstraint(mixed $jsonMatchConstraint) : mixed
Parameters
$jsonMatchConstraint : mixed

getMetaData()

Parse the file meta data.

private getMetaData() : MetaData

"$": { "version": string File Version [mandatory] "copyright": string "created": string File generation date/time ISO8601 [mandatory] "case": string Case==The character casing of the file [optional] }

Tags
throws
JsonException
Return values
MetaData

getPositionConstraint()

The position constraint with structure:

private getPositionConstraint(mixed $jsonPositionConstraint) : mixed

{ "n":integer, n==Min position (positive integer) [mandatory] "x":integer x==Max position (positive integer) [mandatory] }

Parameters
$jsonPositionConstraint : mixed
Tags
throws
JsonException

getPropertiesAsPropertyNameObjects()

Get the Property Names. Note the order of the names is critical. They are referenced by index in other parts of the data file.

private getPropertiesAsPropertyNameObjects() : array<string|int, mixed>

The property names are found in an array with the following structure [ { "n": string n==Property Name [mandatory] "t": char t==Property Type [mandatory] }, {...}, {...}, ... ]

Tags
throws
JsonException
Return values
array<string|int, mixed>

getPropertyConstraint()

Each property constraint is comprised of the following:

private getPropertyConstraint(mixed $jsonPropertyConstraint) : PropertyConstraint

{ (Property Constraint object)

"s": ["string"] (s == source [optional]) "c": [ (c == array of comparison properties [mandatory]) {comparison property},

          ...More comparison properties ...

] }

Parameters
$jsonPropertyConstraint : mixed
Tags
throws
JsonException
Return values
PropertyConstraint

getPropertyConstraints()

Extracts the property constraints for a match candidate.

private getPropertyConstraints(mixed $jsonPropertyConstraints) : array<string|int, mixed>

The property constraints have the following structure:

[ {property constraints rule object 1}, {property constraints rule object 2}, … {property constraints rule object n} ]

Parameters
$jsonPropertyConstraints : mixed
Tags
throws
JsonException
Return values
array<string|int, mixed>

getPropertyName()

Get an individual property name from the following stucture:

private getPropertyName(mixed $jsonPropertyNames) : PropertyName

{ "n": string n==Property Name [mandatory] "t": char-string t==Property Type [mandatory] }

Parameters
$jsonPropertyNames : mixed
Return values
PropertyName

getPropertyValue()

private getPropertyValue(mixed $valueIndex, mixed $dataTypeId) : mixed
Parameters
$valueIndex : mixed
$dataTypeId : mixed

getTokenTrie()

Extract the Token Trie that is used for matching the tokens of incoming identifiers and returning matched components.

private getTokenTrie() : mixed

The Token Trie is a deeply nested collection of objects. It is more efficient to use a custom parser than rely on the generic getObject() method of the JSON tokeniser class as it would create a lot of temporary objects that would just be discarded.

getVersionedSpecificChildren()

Extract the version-specific children:

private getVersionedSpecificChildren(mixed $componentIndex, mixed $jsonComponentVersionSpecificChildren) : VersionSpecificChildren

"vc": { "p": integer (p == property name id [mandatory]) "m": integer, (m == max version parts [mandatory]) "c": [ordered array], (c == version-specific child components [optional] ) }

Parameters
$componentIndex : mixed
$jsonComponentVersionSpecificChildren : mixed
Tags
throws
JsonException
Return values
VersionSpecificChildren

traverse()

Traverse the JSON structure and create the Trie of Nodes for the token start and direct child nodes.

private traverse( &$parentNode) : mixed

{ "t": {nodes...}, t==Token Start Child [mandatory] "c": {nodes...}, c==Direct Child [mandatory] "m": [match candidates] m==Match Candidates [mandatory] }

See the Node class for further details on Token Start and Direct child nodes.

Parameters
$parentNode :
Tags
throws
JsonException

        
On this page

Search results