| @@ 53-73 (lines=21) @@ | ||
| 50 | /** |
|
| 51 | * Constructor. |
|
| 52 | */ |
|
| 53 | public function __construct($options = array()) |
|
| 54 | { |
|
| 55 | foreach ($options as $name=>$value) { |
|
| 56 | switch ($name) { |
|
| 57 | case 'campaign_id': $this->setCampaignId($value); break; |
|
| 58 | case 'confidence_threshold': $this->setConfidenceThreshold($value); break; |
|
| 59 | case 'end_time': $this->setEndTime($value); break; |
|
| 60 | case 'metrics': { |
|
| 61 | $metrics = array(); |
|
| 62 | foreach ($value as $metricInfo) { |
|
| 63 | $metrics[] = new CampaignMetricResults($metricInfo); |
|
| 64 | } |
|
| 65 | $this->setMetrics($metrics); |
|
| 66 | break; |
|
| 67 | } |
|
| 68 | case 'start_time': $this->setStartTime($value); break; |
|
| 69 | default: |
|
| 70 | throw new Exception('Unknown option found in CampaignResults entity: ' . $name); |
|
| 71 | } |
|
| 72 | } |
|
| 73 | } |
|
| 74 | ||
| 75 | /** |
|
| 76 | * Returns this object as array. |
|
| @@ 60-81 (lines=22) @@ | ||
| 57 | /** |
|
| 58 | * Constructor. |
|
| 59 | */ |
|
| 60 | public function __construct($options = array()) |
|
| 61 | { |
|
| 62 | foreach ($options as $name=>$value) { |
|
| 63 | switch ($name) { |
|
| 64 | case 'confidence_threshold': $this->setConfidenceThreshold($value); break; |
|
| 65 | case 'end_time': $this->setEndTime($value); break; |
|
| 66 | case 'experiment_id': $this->setExperimentId($value); break; |
|
| 67 | case 'metrics': { |
|
| 68 | $metrics = array(); |
|
| 69 | foreach ($value as $metricInfo) { |
|
| 70 | $metrics[] = new ExperimentMetricResults($metricInfo); |
|
| 71 | } |
|
| 72 | $this->setMetrics($metrics); |
|
| 73 | break; |
|
| 74 | } |
|
| 75 | case 'reach': $this->setReach(new ExperimentVariationReach($value)); break; |
|
| 76 | case 'start_time': $this->setStartTime($value); break; |
|
| 77 | default: |
|
| 78 | throw new Exception('Unknown option found in the ExperimentVariationReach entity: ' . $name); |
|
| 79 | } |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * Returns this object as array. |
|