1 | <?php |
||
15 | class Variation |
||
16 | { |
||
17 | /** |
||
18 | * A set of actions to take to apply the experiment when running |
||
19 | * @var array[Actions] |
||
20 | */ |
||
21 | private $actions; |
||
22 | |||
23 | /** |
||
24 | * Whether the variation is archived |
||
25 | * @var boolean |
||
26 | */ |
||
27 | private $archived; |
||
28 | |||
29 | /** |
||
30 | * Unique string identifier for this variation within the experiment |
||
31 | * @var string |
||
32 | */ |
||
33 | private $key; |
||
34 | |||
35 | /** |
||
36 | * The name of the variation |
||
37 | * @var string |
||
38 | */ |
||
39 | private $name; |
||
40 | |||
41 | /** |
||
42 | * The ID of the variation |
||
43 | * @var type |
||
44 | */ |
||
45 | private $variationId; |
||
46 | |||
47 | /** |
||
48 | * The weight of the variation expressed as an integer between 0 and 10000. |
||
49 | * The weights of all varitions MUST add up to 10000 total (i.e. 100%) |
||
50 | * @var integer |
||
51 | */ |
||
52 | private $weight; |
||
53 | |||
54 | /** |
||
55 | * Current status of the variation |
||
56 | * @var string |
||
57 | */ |
||
58 | private $status; |
||
59 | |||
60 | /** |
||
61 | * A description of the variation. |
||
62 | * @var type |
||
63 | */ |
||
64 | private $description; |
||
65 | |||
66 | /** |
||
67 | * Constructor. |
||
68 | */ |
||
69 | 7 | public function __construct($options = array()) |
|
92 | |||
93 | /** |
||
94 | * Returns this object as array. |
||
95 | */ |
||
96 | 3 | public function toArray() |
|
122 | |||
123 | 3 | public function getActions() |
|
127 | |||
128 | 7 | public function setActions($actions) |
|
132 | |||
133 | 3 | public function getArchived() |
|
137 | |||
138 | 7 | public function setArchived($archived) |
|
142 | |||
143 | 4 | public function getKey() |
|
147 | |||
148 | 7 | public function setKey($key) |
|
152 | |||
153 | 3 | public function getName() |
|
157 | |||
158 | 7 | public function setName($name) |
|
162 | |||
163 | 3 | public function getVariationId() |
|
167 | |||
168 | 7 | public function setVariationId($variationId) |
|
172 | |||
173 | 3 | public function getWeight() |
|
177 | |||
178 | 7 | public function setWeight($weight) |
|
182 | |||
183 | 3 | public function getStatus() |
|
187 | |||
188 | public function setStatus($status) |
||
192 | |||
193 | 3 | public function getDescription() |
|
197 | |||
198 | public function setDescription($description) |
||
202 | } |
||
203 | |||
212 |
As per the PSR-2 coding standard, case statements should not be wrapped in curly braces. There is no need for braces, since each case is terminated by the next
break
.There is also the option to use a semicolon instead of a colon, this is discouraged because many programmers do not even know it works and the colon is universal between programming languages.
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.