1 | <?php |
||
15 | class Result |
||
16 | { |
||
17 | /** |
||
18 | * Callback result value. |
||
19 | * |
||
20 | * @var mixed |
||
21 | */ |
||
22 | protected $value; |
||
23 | |||
24 | /** |
||
25 | * The time the callback was executed. |
||
26 | * |
||
27 | * @var float |
||
28 | */ |
||
29 | protected $startTime; |
||
30 | |||
31 | /** |
||
32 | * The time the callback finished executing. |
||
33 | * |
||
34 | * @var float |
||
35 | */ |
||
36 | protected $endTime; |
||
37 | |||
38 | /** |
||
39 | * The memory usage before the callback is executed. |
||
40 | * |
||
41 | * @var float |
||
42 | */ |
||
43 | protected $startMemory; |
||
44 | |||
45 | /** |
||
46 | * The memory usage after the callback is executed. |
||
47 | * |
||
48 | * @var float |
||
49 | */ |
||
50 | protected $endMemory; |
||
51 | |||
52 | /** |
||
53 | * Exception thrown by callback. |
||
54 | * |
||
55 | * @var \Exception|null |
||
56 | */ |
||
57 | protected $exception; |
||
58 | |||
59 | /** |
||
60 | * Does the callback result value match the control. |
||
61 | * |
||
62 | * @var boolean |
||
63 | */ |
||
64 | protected $match = false; |
||
65 | |||
66 | /** |
||
67 | * Get the callback result value. |
||
68 | * |
||
69 | * @return mixed |
||
70 | */ |
||
71 | 8 | public function getValue() |
|
75 | |||
76 | /** |
||
77 | * Set the callback result value. |
||
78 | * |
||
79 | * @param mixed $value |
||
80 | * |
||
81 | * @return $this |
||
82 | */ |
||
83 | 11 | public function setValue($value) |
|
89 | |||
90 | /** |
||
91 | * Get the callback execution start time. |
||
92 | * |
||
93 | * @return float |
||
94 | */ |
||
95 | 2 | public function getStartTime() |
|
99 | |||
100 | /** |
||
101 | * Set the callback execution start time. |
||
102 | * |
||
103 | * @param float $startTime |
||
104 | * |
||
105 | * @return $this |
||
106 | */ |
||
107 | 13 | public function setStartTime($startTime) |
|
113 | |||
114 | /** |
||
115 | * Get the callback execution end time. |
||
116 | * |
||
117 | * @return float |
||
118 | */ |
||
119 | 2 | public function getEndTime() |
|
123 | |||
124 | /** |
||
125 | * Set the callback execution end time. |
||
126 | * |
||
127 | * @param float $endTime |
||
128 | * |
||
129 | * @return $this |
||
130 | */ |
||
131 | 12 | public function setEndTime($endTime) |
|
137 | |||
138 | /** |
||
139 | * Get the execution time of the callback. |
||
140 | * |
||
141 | * @return float |
||
142 | */ |
||
143 | 2 | public function getTime() |
|
147 | |||
148 | /** |
||
149 | * Get the callback execution starting memory usage. |
||
150 | * |
||
151 | * @return float |
||
152 | */ |
||
153 | 2 | public function getStartMemory() |
|
157 | |||
158 | /** |
||
159 | * Set the callback execution starting memory usage. |
||
160 | * |
||
161 | * @param float $startMemory |
||
162 | * |
||
163 | * @return $this |
||
164 | */ |
||
165 | 13 | public function setStartMemory($startMemory) |
|
171 | |||
172 | /** |
||
173 | * Get the callback execution ending memory usage. |
||
174 | * |
||
175 | * @return float |
||
176 | */ |
||
177 | 2 | public function getEndMemory() |
|
181 | |||
182 | /** |
||
183 | * Set the callback execution ending memory usage. |
||
184 | * |
||
185 | * @param float $endMemory |
||
186 | * |
||
187 | * @return $this |
||
188 | */ |
||
189 | 12 | public function setEndMemory($endMemory) |
|
195 | |||
196 | /** |
||
197 | * Get the memory spike amount of the callback. |
||
198 | * |
||
199 | * @return float |
||
200 | */ |
||
201 | 1 | public function getMemory() |
|
202 | { |
||
203 | 1 | return $this->endMemory - $this->startMemory; |
|
204 | } |
||
205 | |||
206 | /** |
||
207 | * Get the exception thrown by the callback. |
||
208 | * |
||
209 | * @return Exception|null |
||
210 | */ |
||
211 | 1 | public function getException() |
|
215 | |||
216 | /** |
||
217 | * Set the exception thrown by the callback. |
||
218 | * |
||
219 | * @param Exception|null $exception |
||
220 | * |
||
221 | * @return $this |
||
222 | */ |
||
223 | 2 | public function setException($exception) |
|
229 | |||
230 | /** |
||
231 | * Determine whether the callback result matches the control. |
||
232 | * |
||
233 | * @return boolean |
||
234 | */ |
||
235 | 3 | public function isMatch() |
|
239 | |||
240 | /** |
||
241 | * Set whether the callback result matches the control. |
||
242 | * |
||
243 | * @param boolean $match |
||
244 | * |
||
245 | * @return $this |
||
246 | */ |
||
247 | 3 | public function setMatch($match) |
|
253 | } |
||
254 |