Skip to content

Commit e54aa20

Browse files
committed
docs
1 parent f9d8bb1 commit e54aa20

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

src/ExerciseDispatcher.php

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ class ExerciseDispatcher
5656
private $checkRepository;
5757

5858
/**
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.
6363
*/
6464
public function __construct(
6565
RunnerFactory $runnerFactory,
@@ -74,8 +74,12 @@ public function __construct(
7474
}
7575

7676
/**
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.
7983
*/
8084
public function requireCheck($requiredCheck)
8185
{
@@ -112,11 +116,14 @@ public function requireCheck($requiredCheck)
112116
}
113117

114118
/**
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.
120127
*/
121128
public function verify(ExerciseInterface $exercise, $fileName)
122129
{
@@ -156,10 +163,14 @@ public function verify(ExerciseInterface $exercise, $fileName)
156163
}
157164

158165
/**
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.
163174
*/
164175
public function run(ExerciseInterface $exercise, $fileName, OutputInterface $output)
165176
{
@@ -198,6 +209,8 @@ private function validateChecks(array $checks, ExerciseInterface $exercise)
198209
}
199210

200211
/**
212+
* Retrieve the `EventDispatcher` instance.
213+
*
201214
* @return EventDispatcher
202215
*/
203216
public function getEventDispatcher()

0 commit comments

Comments
 (0)