protected function AcquiaLiftReport::extractTargetingReportData in Acquia Lift Connector 7
Extracts the required targeting report data from the items returned by Acquia Lift.
Parameters
$items: An array of items as return from Acquia Lift.
Return value
array An associative array with feature codes as keys and associative arrays of info as values.
1 call to AcquiaLiftReport::extractTargetingReportData()
- AcquiaLiftReport::loadReportData in plugins/
agent_types/ AcquiaLiftAgent.inc - Loads all of the data necessary to generate the reports for the agent.
File
- plugins/
agent_types/ AcquiaLiftAgent.inc, line 2731 - Provides an agent type for Acquia Lift
Class
- AcquiaLiftReport
- Responsible retrieving and generating reports on the Acquia Lift agent.
Code
protected function extractTargetingReportData($items) {
if (empty($items)) {
return array();
}
$data = array();
foreach ($items as $item) {
$feature = $item['feature'];
$favored_selection = 0;
foreach ($item['choices'] as $i => $choice) {
// Note: Choices are not in order of option.
if ($choice['score'] > $item['choices'][$favored_selection]['score']) {
$favored_selection = $i;
}
}
$data[$feature] = array(
'raw_label' => $item['label'],
'label' => $item['labelText'],
'favored_selection' => $item['choices'][$favored_selection]['label'],
'percent_traffic' => $this
->formatReportPercentage($item['percentTraffic']),
'percent_traffic_graph' => $this
->getGraphLevelClass($item['percentTraffic']),
'predicted_value' => $item['averageResponseValue'],
'stability' => $this
->formatReportNumber($item['stability']),
'stability_positive' => $item['stability'] > self::STABILITY_THRESHOLD,
'stability_level' => $item['stabilityLevel'],
'system' => strpos($item['label'], '[share-alt]') !== FALSE,
);
}
return $data;
}