You are here

public static function AcquiaLiftReportFactory::create in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 includes/AcquiaLiftReportFactory.inc \AcquiaLiftReportFactory::create()

Creates an instance of the Acquia Lift Report class.

Parameters

$agent_instance: The Acquia Lift agent that the reporting is for.

$api_instance: The Acquia Lift API classes in use.

Return value

The AcquiaLiftReport class to use.

1 call to AcquiaLiftReportFactory::create()
AcquiaLiftAgent::getReporting in plugins/agent_types/AcquiaLiftAgent.inc
Get a reference to this agent's reporting class.

File

plugins/agent_types/AcquiaLiftAgent.inc, line 136
Provides an agent type for Acquia Lift

Class

AcquiaLiftReportFactory
Factory class to create a report object for Acquia Lift.

Code

public static function create(PersonalizeAgentInterface $agent_instance, $api_instance) {
  $agent_name = $agent_instance
    ->getMachineName();

  // Check if this agent is set up to read reports from a file instead of
  // calling the API.
  $report_file = variable_get("acquia_lift_report_source_{$agent_name}", '');
  if (!empty($report_file)) {
    $report_source = new AcquiaLiftReportDataFromFile($report_file, new AcquiaLiftReportCache());
  }
  else {
    $report_source = $api_instance;
  }
  if ($agent_instance instanceof AcquiaLiftSimpleAB) {
    $report = new AcquiaLiftABReport($agent_instance, $report_source);
  }
  else {
    $report = new AcquiaLiftReport($agent_instance, $report_source);
  }
  $report
    ->setConfidenceMeasure(variable_get('acquia_lift_confidence_measure', 95));
  return $report;
}