51Degrees Pipeline for PHP

fiftyone\pipeline\cloudrequestengine\CloudRequestEngine Class Reference

Inheritance diagram for fiftyone\pipeline\cloudrequestengine\CloudRequestEngine:

[legend]

Collaboration diagram for fiftyone\pipeline\cloudrequestengine\CloudRequestEngine:

[legend]

Public Member Functions

 __construct (array $settings)
 Settings should contain a resourceKey, a licenseKey or both, and optionally: 1) requestedProperties, the fully qualified names of the properties to ask for, as an array or one comma separated string.
 onRegistration (Pipeline $pipeline)
 Logs, as a warning through the logger of the first pipeline the engine is added to, that the base URL came from the deprecated environment variable.
 getEvidenceKeyFilter ()
 Instance of EvidenceKeyFilter of the evidence keys the cloud service lists.
 processInternal (FlowData $flowData)
 Processing function for the CloudRequestEngine Makes a request to the cloud service with the supplied resource key and evidence and returns a JSON object that is then parsed by cloud engines placed later in the pipeline.
 getContent (FlowData $flowData)
 Generate the Content to send in the POST request.
 addQueryData (array $queryData, array $allEvidence, array $evidence)
 Add query data to the evidence.
 getSelectedEvidence (array $evidence, string $type)
 Get evidence with specified prefix.
 keyHasPrefix (string $itemKey, string $prefix)
 Check that the key of a KeyValuePair has the given prefix.
 getEngineProperties ()
 Get properties for cloud engines from the cloud service.

Public Member Functions inherited from fiftyone\pipeline\engines\Engine

 getDataSourceTier ()
 Get the tier to which the current data source belongs.
 setCache (DataKeyedCache $cache)
 Add a cache to an engine.
 setRestrictedProperties (array $propertiesList)
 Add a subset of properties.
 inCache (FlowData $flowData)
 A method to check if a flowData's evidence is in the cache.
 process (FlowData $flowData)
 Engine's core process function.

Public Member Functions inherited from fiftyone\pipeline\core\FlowElement

 __construct ()
 A default dummy constructor is needed for there are classes inheriting this class deeper than 1-level of inheritance and calling parent::__construct() in their explicit constructors.
 filterEvidence (FlowData $flowData)
 Filter FlowData evidence using the FlowElement's EvidenceKeyFilter.
 filterEvidenceKey (string $key)
 Filter FlowData evidence using the FlowElement's EvidenceKeyFilter.
 getProperties ()
 Get properties Usually overridden by specific FlowElements.
 updatePropertyList ()
 Update a FlowElement's property list This is used by elements that are only aware of their properties at a later stage, such as cloud request based FlowElements or FlowElements that change their properties later based on new datafiles.

Data Fields

string $dataKey = 'cloud'
string $baseURL
string $cloudRequestOrigin
array $flowElementProperties = []
string $resourceKey
string $licenseKey
array $requestedProperties

Data Fields inherited from fiftyone\pipeline\engines\Engine

array $restrictedProperties

Data Fields inherited from fiftyone\pipeline\core\FlowElement

string $dataKey
array $properties = []
array $pipelines = []

Protected Member Functions

 holdsValueForOneRequest (ElementData $data)
 A response whose JSON has a top-level member named fodid, in any case, holds a 51Did created for the one request.

Constructor & Destructor Documentation

◆ __construct()

fiftyone\pipeline\cloudrequestengine\CloudRequestEngine::__construct ( array $settings)

Settings should contain a resourceKey, a licenseKey or both, and optionally: 1) requestedProperties, the fully qualified names of the properties to ask for, as an array or one comma separated string.

Required with a licenseKey on its own. Beside a resourceKey the cloud service adds them to the properties the resource key carries. 2) a cloudEndPoint to overwrite the default baseurl 3) a cloudRequestOrigin to use when sending requests to cloud.

Parameters
array{resourceKey?: string, licenseKey?: string, requestedProperties?: array<string>|string, cloudEndPoint?: string, cloudRequestOrigin?: string, httpClient?: \fiftyone\pipeline\cloudrequestengine\HttpClient } $settings

Member Function Documentation

◆ addQueryData()

fiftyone\pipeline\cloudrequestengine\CloudRequestEngine::addQueryData ( array $queryData,
array $allEvidence,
array $evidence )

Add query data to the evidence.

Parameters
array<string,string>$queryData The destination Array to add query data to
array<string,int|string>$allEvidence All evidence in the flow data. This is used to report which evidence keys are conflicting
array<string,int|string>$evidence Evidence to add to the query Data
Returns
array<string, int|string>

◆ getContent()

fiftyone\pipeline\cloudrequestengine\CloudRequestEngine::getContent ( FlowData $flowData)

Generate the Content to send in the POST request.

One name under several prefixes is sent once, with the value of the prefix that evidence.md ranks highest, being query, header, cookie, server, fiftyone and location, then any other prefix alphabetically. The groups are added lowest precedence first, so a later value replaces an earlier one, and a replacement by a key other than a query key is raised as a warning.

Every Evidence value goes in, including a value no element in the Pipeline accepts, because what the cloud service uses changes over time. The reserved names, and any value under the web request view's key, are left out by addQueryData. The view itself is never in the Evidence values.

Returns
array<string, int|string>

◆ getEngineProperties()

fiftyone\pipeline\cloudrequestengine\CloudRequestEngine::getEngineProperties ( )

Get properties for cloud engines from the cloud service.

Returns
array<string, string|array<string, array<string, bool|string>>>

◆ getEvidenceKeyFilter()

fiftyone\pipeline\cloudrequestengine\CloudRequestEngine::getEvidenceKeyFilter ( )

Instance of EvidenceKeyFilter of the evidence keys the cloud service lists.

The keys are fetched the first time they are needed, which is when the first Evidence is set, so that the Evidence the cloud service uses is kept. A failed fetch leaves the list empty, and processInternal reports the failure.

Reimplemented from fiftyone\pipeline\core\FlowElement.

◆ getSelectedEvidence()

fiftyone\pipeline\cloudrequestengine\CloudRequestEngine::getSelectedEvidence ( array $evidence,
string $type )

Get evidence with specified prefix.

Parameters
array<string,int|string>$evidence All evidence in the flow data
string$typeRequired evidence key prefix
Returns
array<string, int|string>

◆ holdsValueForOneRequest()

fiftyone\pipeline\cloudrequestengine\CloudRequestEngine::holdsValueForOneRequest ( ElementData $data)
protected

A response whose JSON has a top-level member named fodid, in any case, holds a 51Did created for the one request.

Reimplemented from fiftyone\pipeline\engines\Engine.

◆ keyHasPrefix()

fiftyone\pipeline\cloudrequestengine\CloudRequestEngine::keyHasPrefix ( string $itemKey,
string $prefix )

Check that the key of a KeyValuePair has the given prefix.

Parameters
string$itemKeyKey to check
string$prefixThe prefix to check for
Returns
bool true if the key has the prefix

◆ onRegistration()

fiftyone\pipeline\cloudrequestengine\CloudRequestEngine::onRegistration ( Pipeline $pipeline)

Logs, as a warning through the logger of the first pipeline the engine is added to, that the base URL came from the deprecated environment variable.

Each engine logs it once, so a site that builds its pipeline in every request logs it in every request.

Reimplemented from fiftyone\pipeline\core\FlowElement.

◆ processInternal()

fiftyone\pipeline\cloudrequestengine\CloudRequestEngine::processInternal ( FlowData $flowData)

Processing function for the CloudRequestEngine Makes a request to the cloud service with the supplied resource key and evidence and returns a JSON object that is then parsed by cloud engines placed later in the pipeline.

Reimplemented from fiftyone\pipeline\core\FlowElement.