1 | <?php |
||
20 | final class Result |
||
21 | { |
||
22 | /** |
||
23 | * @var Score The score |
||
24 | */ |
||
25 | private $score; |
||
26 | |||
27 | /** |
||
28 | * @var bool Indicates whether or not the attempt was successful |
||
29 | */ |
||
30 | private $success; |
||
31 | |||
32 | /** |
||
33 | * @var bool Indicates whether or not the Activity was completed |
||
34 | */ |
||
35 | private $completion; |
||
36 | |||
37 | /** |
||
38 | * @var string A response for the given Activity |
||
39 | */ |
||
40 | private $response; |
||
41 | |||
42 | /** |
||
43 | * @var string Period of time over which the Activity was performed |
||
44 | */ |
||
45 | private $duration; |
||
46 | |||
47 | /** |
||
48 | * @var Extensions|null Extensions associated with this result |
||
49 | */ |
||
50 | private $extensions; |
||
51 | |||
52 | /** |
||
53 | * @param Score|null $score |
||
54 | * @param bool|null $success |
||
55 | * @param bool|null $completion |
||
56 | * @param string|null $response |
||
57 | * @param string|null $duration |
||
58 | * @param Extensions|null $extensions |
||
59 | */ |
||
60 | public function __construct(Score $score = null, $success = null, $completion = null, $response = null, $duration = null, Extensions $extensions = null) |
||
69 | |||
70 | public function withScore(Score $score = null) |
||
77 | |||
78 | /** |
||
79 | * @param bool|null $success |
||
80 | * |
||
81 | * @return Result |
||
82 | */ |
||
83 | public function withSuccess($success) |
||
90 | |||
91 | /** |
||
92 | * @param bool|null $completion |
||
93 | * |
||
94 | * @return Result |
||
95 | */ |
||
96 | public function withCompletion($completion) |
||
103 | |||
104 | /** |
||
105 | * @param string|null $response |
||
106 | * |
||
107 | * @return Result |
||
108 | */ |
||
109 | public function withResponse($response) |
||
116 | |||
117 | /** |
||
118 | * @param string|null $duration |
||
119 | * |
||
120 | * @return Result |
||
121 | */ |
||
122 | public function withDuration($duration) |
||
129 | |||
130 | public function withExtensions(Extensions $extensions = null) |
||
137 | |||
138 | /** |
||
139 | * Returns the user's score. |
||
140 | * |
||
141 | * @return Score The score |
||
142 | */ |
||
143 | public function getScore() |
||
147 | |||
148 | /** |
||
149 | * Returns whether or not the user finished a task successfully. |
||
150 | * |
||
151 | * @return bool True if the user finished an exercise successfully, false |
||
152 | * otherwise |
||
153 | */ |
||
154 | public function getSuccess() |
||
158 | |||
159 | /** |
||
160 | * Returns the completion status. |
||
161 | * |
||
162 | * @return bool $completion True, if the Activity was completed, false |
||
163 | * otherwise |
||
164 | */ |
||
165 | public function getCompletion() |
||
169 | |||
170 | /** |
||
171 | * Returns the response. |
||
172 | * |
||
173 | * @return string The response |
||
174 | */ |
||
175 | public function getResponse() |
||
179 | |||
180 | /** |
||
181 | * Returns the period of time over which the Activity was performed. |
||
182 | * |
||
183 | * @return string The duration |
||
184 | */ |
||
185 | public function getDuration() |
||
189 | |||
190 | /** |
||
191 | * Returns the extensions associated with the result. |
||
192 | * |
||
193 | * @return Extensions|null The extensions |
||
194 | */ |
||
195 | public function getExtensions() |
||
199 | |||
200 | /** |
||
201 | * Checks if another result is equal. |
||
202 | * |
||
203 | * Two results are equal if and only if all of their properties are equal. |
||
204 | * |
||
205 | * @param Result $result The result to compare with |
||
206 | * |
||
207 | * @return bool True if the results are equal, false otherwise |
||
208 | */ |
||
209 | public function equals(Result $result) |
||
245 | } |
||
246 |