LoggingRemoteExecuteMethod   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 37
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A execute() 0 23 2
1
<?php
2
3
namespace Magium\WebDriver;
4
5
use Facebook\WebDriver\Remote\RemoteExecuteMethod;
6
use Magium\Util\Log\LoggerInterface;
7
8
class LoggingRemoteExecuteMethod extends RemoteExecuteMethod
9
{
10
    protected $logger;
11
12
    public function __construct(WebDriver $driver, LoggerInterface $logger)
13
    {
14
        parent::__construct($driver);
15
        $this->logger = $logger;
16
    }
17
18
19
    public function execute(
20
        $command_name,
21
        array $parameters = array()
22
    )
23
    {
24
        $extra = [
25
            'type'      => 'webdriver-activity',
26
            'activity'  => 'action',
27
            'command'   => $command_name
28
        ];
29
30
        if (isset($parameters[':id'])) {
31
            $extra['id'] = $parameters[':id'];
32
        }
33
34
        $this->logger->debug(
35
            sprintf(
36
                'Executing: ' . $command_name
37
            ),
38
            $extra
39
        );
40
        return parent::execute($command_name, $parameters); // TODO: Change the autogenerated stub
41
    }
42
43
44
}
45