GeckoProvider::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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