1 | <?php |
||
10 | class Study |
||
11 | { |
||
12 | /** |
||
13 | * Experiment name. |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $name; |
||
18 | |||
19 | /** |
||
20 | * The control instance. |
||
21 | * |
||
22 | * @var mixed |
||
23 | */ |
||
24 | protected $control; |
||
25 | |||
26 | /** |
||
27 | * Trial instances. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $trials = []; |
||
32 | |||
33 | /** |
||
34 | * Laboratory instance. |
||
35 | * |
||
36 | * @var \Scientist\Laboratory|null |
||
37 | */ |
||
38 | protected $laboratory; |
||
39 | |||
40 | /** |
||
41 | * Matcher for experiment values. |
||
42 | * |
||
43 | * @var \Scientist\Matchers\Matcher |
||
44 | */ |
||
45 | protected $matcher; |
||
46 | |||
47 | /** |
||
48 | * Execution chance. |
||
49 | * |
||
50 | * @var integer |
||
51 | */ |
||
52 | protected $chance = 100; |
||
53 | |||
54 | /** |
||
55 | * @var Experiment[] |
||
56 | */ |
||
57 | protected $experiments = []; |
||
58 | |||
59 | /** |
||
60 | * Study constructor. |
||
61 | * @param string $name |
||
62 | * @param null|Laboratory $laboratory |
||
63 | */ |
||
64 | 20 | public function __construct($name, $laboratory = null) |
|
70 | |||
71 | /** |
||
72 | * @return string |
||
73 | */ |
||
74 | 15 | public function getName() |
|
78 | |||
79 | /** |
||
80 | * @param string $name |
||
81 | */ |
||
82 | public function setName($name) |
||
86 | |||
87 | /** |
||
88 | * @return mixed |
||
89 | */ |
||
90 | 6 | public function getControl() |
|
94 | |||
95 | /** |
||
96 | * @param mixed $control |
||
97 | * @return $this |
||
98 | */ |
||
99 | 6 | public function control($control) |
|
104 | |||
105 | /** |
||
106 | * @return array |
||
107 | */ |
||
108 | 7 | public function getTrials() |
|
112 | |||
113 | /** |
||
114 | * @param string $name |
||
115 | * @return mixed |
||
116 | */ |
||
117 | 1 | public function getTrial($name) |
|
121 | |||
122 | /** |
||
123 | * @param string $name |
||
124 | * @param mixed $trial |
||
125 | * @return $this |
||
126 | */ |
||
127 | 7 | public function trial($name, $trial) |
|
132 | |||
133 | /** |
||
134 | * @return null|Laboratory |
||
135 | */ |
||
136 | 11 | public function getLaboratory() |
|
140 | |||
141 | /** |
||
142 | * @param null|Laboratory $laboratory |
||
143 | */ |
||
144 | 1 | public function setLaboratory($laboratory) |
|
148 | |||
149 | /** |
||
150 | * @return Matchers\Matcher |
||
151 | */ |
||
152 | 11 | public function getMatcher() |
|
156 | |||
157 | /** |
||
158 | * @param Matchers\Matcher $matcher |
||
159 | */ |
||
160 | 1 | public function setMatcher($matcher) |
|
164 | |||
165 | /** |
||
166 | * @return int |
||
167 | */ |
||
168 | 11 | public function getChance() |
|
172 | |||
173 | /** |
||
174 | * @param int $chance |
||
175 | */ |
||
176 | 1 | public function setChance($chance) |
|
180 | |||
181 | /** |
||
182 | * @return Experiment[] |
||
183 | */ |
||
184 | 1 | public function getExperiments() |
|
188 | |||
189 | /** |
||
190 | * @param string $name |
||
191 | * @return Experiment |
||
192 | */ |
||
193 | 3 | public function getExperiment($name) |
|
197 | |||
198 | /** |
||
199 | * @param Experiment $experiment |
||
200 | */ |
||
201 | 11 | public function addExperiment(Experiment $experiment) |
|
205 | |||
206 | /** |
||
207 | * @param string ...$interface blind will implement the interfaces specified |
||
208 | * @return mixed |
||
209 | */ |
||
210 | 6 | public function blind($interface = null) |
|
220 | } |