Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public function createRunner(string $id): RunnerInterface |
||
19 | { |
||
20 | try { |
||
21 | $runner = $this->instantiator->getNewObject( |
||
22 | Configs::expand(Configs::RUNNER_ID, $id), |
||
23 | ); |
||
24 | } catch (InstantiatorException $exception) { |
||
25 | throw new InvalidRunnerException("Invalid runner $id: {$exception->getMessage()}"); |
||
26 | } |
||
27 | |||
28 | if (!$runner instanceof RunnerInterface) { |
||
29 | throw new InvalidRunnerException( |
||
30 | "Invalid runner $id: Class does not implement RunnerInterface" |
||
31 | ); |
||
32 | } |
||
33 | |||
34 | return $runner; |
||
35 | } |
||
37 |