GeckoProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 45
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 8 1
A handle() 0 3 1
A serverUrl() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace Bavix\Cases\Provider;
4
5
use Facebook\WebDriver\Remote\DesiredCapabilities;
6
use Facebook\WebDriver\WebDriverDimension;
7
use Bavix\Cases\Provider;
8
use Bavix\Cases\Params;
9
use Bavix\Cases\RemoteWebDriver;
10
11
class GeckoProvider implements Provider
12
{
13
14
    /**
15
     * @var Params
16
     */
17
    protected $params;
18
19
    /**
20
     * ChromeCap constructor.
21
     * @param Params $params
22
     */
23
    public function __construct(Params $params)
24
    {
25
        $this->params = $params;
26
    }
27
28
    /**
29
     * @return DesiredCapabilities
30
     */
31
    public function handle(): DesiredCapabilities
32
    {
33
        return DesiredCapabilities::firefox();
34
    }
35
36
    /**
37
     * @return string
38
     */
39
    public function serverUrl(): string
40
    {
41
        return $_ENV['GECKO_URL'];
42
    }
43
44
    /**
45
     * @param RemoteWebDriver $driver
46
     * @return void
47
     */
48
    public function configure(RemoteWebDriver $driver)
49
    {
50
        $dimension = new WebDriverDimension(
51
            $this->params->getWidth(),
52
            $this->params->getHeight()
53
        );
54
55
        $driver->manage()->window()->setSize($dimension);
56
    }
57
58
}
59