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

Request   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 24
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __call() 0 4 1
A getClient() 0 9 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