Completed
Push — master ( 9abf36...7af07c )
by Nils
02:14
created

ChromeClient::setOption()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace whm\Smoke\Http;
4
5
use phm\HttpWebdriverClient\Http\Client\Chrome\ChromeClient as phmChromeClient;
6
use phm\HttpWebdriverClient\Http\Client\Decorator\FileCacheDecorator;
7
use phm\HttpWebdriverClient\Http\Client\Decorator\LoggerDecorator;
8
use phm\HttpWebdriverClient\Http\Client\HttpClient;
9
use Psr\Http\Message\RequestInterface;
10
11 View Code Duplication
class ChromeClient implements HttpClient
12
{
13
    /**
14
     * @var phmChromeClient
15
     */
16
    private $chromeClient;
17
18
    public function init($host = 'localhost', $port = 4444, $nocache = false)
19
    {
20
        if ($nocache) {
21
            $this->chromeClient = new phmChromeClient($host, $port);
22
        } else {
23
            $chromeClient = new phmChromeClient($host, $port);
24
            $cachedClient = new FileCacheDecorator($chromeClient);
25
            $this->chromeClient = new LoggerDecorator($cachedClient);
0 ignored issues
show
Documentation Bug introduced by
It seems like new \phm\HttpWebdriverCl...ecorator($cachedClient) of type object<phm\HttpWebdriver...orator\LoggerDecorator> is incompatible with the declared type object<phm\HttpWebdriver...nt\Chrome\ChromeClient> of property $chromeClient.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
26
        }
27
    }
28
29
    public function sendRequest(RequestInterface $request)
30
    {
31
        return $this->chromeClient->sendRequest($request);
32
    }
33
34
    public function sendRequests(array $requests)
35
    {
36
        return $this->chromeClient->sendRequests($requests);
37
    }
38
39
    public function getClientType()
40
    {
41
        return $this->chromeClient->getClientType();
42
    }
43
44
    public function close()
45
    {
46
        $this->chromeClient->close();
47
    }
48
49
    public function setOption($key, $value)
50
    {
51
        $this->chromeClient->setOption($key, $value);
0 ignored issues
show
Bug introduced by
The method setOption() does not seem to exist on object<phm\HttpWebdriver...nt\Chrome\ChromeClient>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
52
    }
53
}
54