1 | <?php |
||
14 | class Result |
||
15 | { |
||
16 | /** |
||
17 | * Callback result value. |
||
18 | * |
||
19 | * @var mixed |
||
20 | */ |
||
21 | protected $value; |
||
22 | |||
23 | /** |
||
24 | * The time the callback was executed. |
||
25 | * |
||
26 | * @var float |
||
27 | */ |
||
28 | protected $startTime; |
||
29 | |||
30 | /** |
||
31 | * The time the callback finished executing. |
||
32 | * |
||
33 | * @var float |
||
34 | */ |
||
35 | protected $endTime; |
||
36 | |||
37 | /** |
||
38 | * The memory usage before the callback is executed. |
||
39 | * |
||
40 | * @var float |
||
41 | */ |
||
42 | protected $startMemory; |
||
43 | |||
44 | /** |
||
45 | * The memory usage after the callback is executed. |
||
46 | * |
||
47 | * @var float |
||
48 | */ |
||
49 | protected $endMemory; |
||
50 | |||
51 | /** |
||
52 | * Exception thrown by callback. |
||
53 | * |
||
54 | * @var \Exception|null |
||
55 | */ |
||
56 | protected $exception; |
||
57 | |||
58 | /** |
||
59 | * Does the callback result value match the control. |
||
60 | * |
||
61 | * @var boolean |
||
62 | */ |
||
63 | protected $match = false; |
||
64 | |||
65 | /** |
||
66 | * @var mixed |
||
67 | */ |
||
68 | protected $context; |
||
69 | |||
70 | public function __construct($context = null) |
||
74 | |||
75 | /** |
||
76 | * Get the callback result value. |
||
77 | * |
||
78 | * @return mixed |
||
79 | */ |
||
80 | public function getValue() |
||
84 | |||
85 | 18 | /** |
|
86 | * Set the callback result value. |
||
87 | 18 | * |
|
88 | * @param mixed $value |
||
89 | * |
||
90 | * @return $this |
||
91 | */ |
||
92 | public function setValue($value) |
||
98 | |||
99 | /** |
||
100 | * Get the callback execution start time. |
||
101 | * |
||
102 | * @return float |
||
103 | */ |
||
104 | public function getStartTime() |
||
108 | |||
109 | 21 | /** |
|
110 | * Set the callback execution start time. |
||
111 | 21 | * |
|
112 | * @param float $startTime |
||
113 | * |
||
114 | * @return $this |
||
115 | */ |
||
116 | public function setStartTime($startTime) |
||
122 | |||
123 | /** |
||
124 | * Get the callback execution end time. |
||
125 | * |
||
126 | * @return float |
||
127 | */ |
||
128 | public function getEndTime() |
||
132 | |||
133 | 19 | /** |
|
134 | * Set the callback execution end time. |
||
135 | 19 | * |
|
136 | * @param float $endTime |
||
137 | * |
||
138 | * @return $this |
||
139 | */ |
||
140 | public function setEndTime($endTime) |
||
146 | |||
147 | /** |
||
148 | * Get the execution time of the callback. |
||
149 | * |
||
150 | * @return float |
||
151 | */ |
||
152 | public function getTime() |
||
156 | |||
157 | /** |
||
158 | * Get the callback execution starting memory usage. |
||
159 | * |
||
160 | * @return float |
||
161 | */ |
||
162 | public function getStartMemory() |
||
166 | |||
167 | 21 | /** |
|
168 | * Set the callback execution starting memory usage. |
||
169 | 21 | * |
|
170 | * @param float $startMemory |
||
171 | * |
||
172 | * @return $this |
||
173 | */ |
||
174 | public function setStartMemory($startMemory) |
||
180 | |||
181 | /** |
||
182 | * Get the callback execution ending memory usage. |
||
183 | * |
||
184 | * @return float |
||
185 | */ |
||
186 | public function getEndMemory() |
||
190 | |||
191 | 19 | /** |
|
192 | * Set the callback execution ending memory usage. |
||
193 | 19 | * |
|
194 | * @param float $endMemory |
||
195 | * |
||
196 | * @return $this |
||
197 | */ |
||
198 | public function setEndMemory($endMemory) |
||
204 | |||
205 | /** |
||
206 | * Get the memory spike amount of the callback. |
||
207 | * |
||
208 | * @return float |
||
209 | */ |
||
210 | public function getMemory() |
||
214 | |||
215 | /** |
||
216 | * Get the exception thrown by the callback. |
||
217 | * |
||
218 | * @return Exception|null |
||
219 | */ |
||
220 | public function getException() |
||
224 | |||
225 | 3 | /** |
|
226 | * Set the exception thrown by the callback. |
||
227 | 3 | * |
|
228 | * @param Exception|null $exception |
||
229 | * |
||
230 | * @return $this |
||
231 | */ |
||
232 | public function setException($exception) |
||
238 | |||
239 | public function getContext() |
||
240 | { |
||
241 | return $this->context; |
||
242 | } |
||
243 | |||
244 | /** |
||
245 | * Determine whether the callback result matches the control. |
||
246 | * |
||
247 | 4 | * @return boolean |
|
248 | */ |
||
249 | 4 | public function isMatch() |
|
253 | |||
254 | /** |
||
255 | * Set whether the callback result matches the control. |
||
256 | * |
||
257 | * @param boolean $match |
||
258 | * |
||
259 | * @return $this |
||
260 | */ |
||
261 | public function setMatch($match) |
||
267 | } |
||
268 |