Dispatcher   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 8
dl 0
loc 17
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A dispatch() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WSW\BrowserAutomation\Scenario\Dispatcher;
6
7
use Facebook\WebDriver\WebDriver;
8
use WSW\BrowserAutomation\Scenario\Scenario;
9
10
/**
11
 * Class Dispatcher
12
 *
13
 * @package WSW\BrowserAutomation\Scenario\Dispatcher
14
 */
15
class Dispatcher implements DispatcherInterface
16
{
17
18
    /**
19
     * {@inheritdoc}
20
     */
21 9
    public function dispatch(Scenario $scenario, WebDriver $driver): array
22
    {
23 9
        $start  = microtime(true);
24
25 9
        call_user_func($scenario->getCallback(), $scenario->pipeline());
26 9
        $tasks = $scenario->pipeline()->process($driver);
27
28
        return [
29 9
            'name'  => $scenario->getName(),
30 9
            'tasks' => $tasks,
31 9
            'duration' => round(microtime(true) - $start, 4)
32
        ];
33
    }
34
}
35