@@ -56,10 +56,10 @@ class ExerciseDispatcher
56
56
private $ checkRepository ;
57
57
58
58
/**
59
- * @param RunnerFactory $runnerFactory
60
- * @param ResultAggregator $resultAggregator
61
- * @param EventDispatcher $eventDispatcher
62
- * @param CheckRepository $checkRepository
59
+ * @param RunnerFactory $runnerFactory Factory capable of building an exercise runner based on the exercise type.
60
+ * @param ResultAggregator $resultAggregator Result Aggregator.
61
+ * @param EventDispatcher $eventDispatcher Event Dispatcher instance.
62
+ * @param CheckRepository $checkRepository The Check repository.
63
63
*/
64
64
public function __construct (
65
65
RunnerFactory $ runnerFactory ,
@@ -74,8 +74,12 @@ public function __construct(
74
74
}
75
75
76
76
/**
77
- * @param string $requiredCheck
78
- * @throws InvalidArgumentException
77
+ * Queue a specific check to be run when the exercise is verified. When the exercise is verified
78
+ * the check specified as the first argument will also be executed. Throws an InvalidArgumentException
79
+ * if the check does not exist in the CheckRepository.
80
+ *
81
+ * @param string $requiredCheck The name of the required check.
82
+ * @throws InvalidArgumentException If the check does not exist.
79
83
*/
80
84
public function requireCheck ($ requiredCheck )
81
85
{
@@ -112,11 +116,14 @@ public function requireCheck($requiredCheck)
112
116
}
113
117
114
118
/**
115
- * @param ExerciseInterface $exercise
116
- * @param string $fileName
117
- * @return ResultAggregator
118
- * @throws CheckNotApplicableException
119
- * @throws ExerciseNotConfiguredException
119
+ * Verify a students solution against a specific exercise. Runs queued checks based on their position. Invokes the
120
+ * correct runner for the exercise based on the exercise type. Various events are triggered throughout the process.
121
+ *
122
+ * @param ExerciseInterface $exercise The exercise instance.
123
+ * @param string $fileName The absolute file name of the students solution.
124
+ * @return ResultAggregator The result aggregator which contains all the results injected via the runner, checks and events.
125
+ * @throws CheckNotApplicableException If the check is not applicable to the exercise type.
126
+ * @throws ExerciseNotConfiguredException If the exercise does not implement the correct interface based on the checks required.
120
127
*/
121
128
public function verify (ExerciseInterface $ exercise , $ fileName )
122
129
{
@@ -156,10 +163,14 @@ public function verify(ExerciseInterface $exercise, $fileName)
156
163
}
157
164
158
165
/**
159
- * @param ExerciseInterface $exercise
160
- * @param string $fileName
161
- * @param OutputInterface $output
162
- * @return bool
166
+ * Run a students solution against a specific exercise. Does not invoke checks. Invokes the
167
+ * correct runner for the exercise based on the exercise type. Various events are triggered throughout the process.
168
+ * The output of the solution is written directly to the OutputInterface instance.
169
+ *
170
+ * @param ExerciseInterface $exercise The exercise instance.
171
+ * @param string $fileName The absolute file name of the students solution.
172
+ * @param OutputInterface $output An output instance capable of writing to stdout.
173
+ * @return bool Whether the solution ran successfully or not.
163
174
*/
164
175
public function run (ExerciseInterface $ exercise , $ fileName , OutputInterface $ output )
165
176
{
@@ -198,6 +209,8 @@ private function validateChecks(array $checks, ExerciseInterface $exercise)
198
209
}
199
210
200
211
/**
212
+ * Retrieve the `EventDispatcher` instance.
213
+ *
201
214
* @return EventDispatcher
202
215
*/
203
216
public function getEventDispatcher ()
0 commit comments