1 | <?php |
||
12 | class ExperimentMetricResults |
||
13 | { |
||
14 | /** |
||
15 | * |
||
16 | * @var string |
||
17 | */ |
||
18 | private $event; |
||
19 | |||
20 | /** |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | private $eventName; |
||
25 | |||
26 | /** |
||
27 | * Conversions indicate the total number of visitors or sessions where the |
||
28 | * event happened. Impressions indicate the total number of times the event |
||
29 | * happened (possibly multiple per visitor or session). Revenue indicates |
||
30 | * the sum of all revenue sent from all events in the Experiment. |
||
31 | * Can be 'conversions', 'impressions' or 'revenue'. |
||
32 | * @var string |
||
33 | */ |
||
34 | private $measure; |
||
35 | |||
36 | /** |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | private $metricId; |
||
41 | |||
42 | /** |
||
43 | * |
||
44 | * @var integer |
||
45 | */ |
||
46 | private $priority; |
||
47 | |||
48 | /** |
||
49 | * Can be 'session', 'visitor' or 'event' |
||
50 | * @var string |
||
51 | */ |
||
52 | private $unit; |
||
53 | |||
54 | /** |
||
55 | * A map of results for each Variation in the Experiment keyed by Variation ID |
||
56 | * @var array[VariantResults] |
||
57 | */ |
||
58 | private $variationResults; |
||
59 | |||
60 | /** |
||
61 | * Constructor. |
||
62 | */ |
||
63 | 3 | public function __construct($options = array()) |
|
64 | { |
||
65 | 3 | foreach ($options as $name=>$value) { |
|
66 | switch ($name) { |
||
67 | 3 | case 'event': $this->setEvent($value); break; |
|
68 | 3 | case 'event_name': $this->setEventName($value); break; |
|
69 | 3 | case 'measure': $this->setMeasure($value); break; |
|
70 | 3 | case 'metric_id': $this->setMetricId($value); break; |
|
71 | 3 | case 'priority': $this->setPriority($value); break; |
|
72 | 3 | case 'unit': $this->setUnit($value); break; |
|
73 | 3 | case 'variation_results': $this->setVariationResults($value); break; |
|
74 | default: |
||
75 | 3 | throw new \Exception('Unknown option: ' . $name); |
|
76 | } |
||
77 | } |
||
78 | 3 | } |
|
79 | |||
80 | /** |
||
81 | * Returns this object as array. |
||
82 | */ |
||
83 | 1 | public function toArray() |
|
84 | { |
||
85 | return array( |
||
86 | 1 | 'event' => $this->getEvent(), |
|
87 | 1 | 'event_name' => $this->getEventName(), |
|
88 | 1 | 'measure' => $this->getMeasure(), |
|
89 | 1 | 'metric_id' => $this->getMetricId(), |
|
90 | 1 | 'priority' => $this->getPriority(), |
|
91 | 1 | 'unit' => $this->getUnit(), |
|
92 | 1 | 'variation_results' => $this->getVariationResults(), |
|
93 | ); |
||
94 | } |
||
95 | |||
96 | 1 | public function getEvent() |
|
100 | |||
101 | 3 | public function setEvent($event) |
|
105 | |||
106 | 1 | public function getEventName() |
|
110 | |||
111 | 3 | public function setEventName($eventName) |
|
115 | |||
116 | 1 | public function getMeasure() |
|
120 | |||
121 | 3 | public function setMeasure($measure) |
|
125 | |||
126 | 1 | public function getMetricId() |
|
130 | |||
131 | 3 | public function setMetricId($metricId) |
|
135 | |||
136 | 1 | public function getPriority() |
|
140 | |||
141 | 3 | public function setPriority($priority) |
|
145 | |||
146 | 1 | public function getUnit() |
|
150 | |||
151 | 3 | public function setUnit($unit) |
|
155 | |||
156 | 1 | public function getVariationResults() |
|
160 | |||
161 | 3 | public function setVariationResults($variationResults) |
|
165 | } |
||
166 | |||
167 | |||
176 |
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.