Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
21 | 15 | public function process(TaskInterface $task, WebDriver $driver): array |
|
22 | { |
||
23 | 15 | $name = get_class($task); |
|
24 | 15 | $start = microtime(true); |
|
25 | 15 | $succes = false; |
|
26 | 15 | $error = null; |
|
27 | |||
28 | try { |
||
29 | 15 | $task->handle($driver); |
|
30 | 12 | $succes = true; |
|
31 | 3 | } catch (\Throwable $e) { |
|
32 | 3 | $error = $e->getMessage(); |
|
33 | } |
||
34 | |||
35 | return [ |
||
36 | 15 | 'task' => $name, |
|
37 | 15 | 'success' => $succes, |
|
38 | 15 | 'error' => $error, |
|
39 | 15 | 'duration' => round(microtime(true) - $start, 4) |
|
40 | ]; |
||
43 |