Completed
Push — 3.x ( 873f60...3697fd )
by San
07:47 queued 04:17
created

Request::__call()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace Behatch\HttpCall;
4
5
use Behat\Mink\Mink;
6
7
class Request
8
{
9
    private $mink;
10
11
    public function __construct(Mink $mink)
12
    {
13
        $this->mink = $mink;
14
    }
15
16
    public function __call($name, $arguments)
17
    {
18
        return call_user_func_array([$this->getClient(), $name], $arguments);
19
    }
20
21
    private function getClient()
22
    {
23
        if ($this->mink->getDefaultSessionName() === 'symfony2') {
24
            return new Request\Goutte($this->mink);
25
        }
26
        else {
27
            return new Request\BrowserKit($this->mink);
28
        }
29
    }
30
}
31