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