ClientFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 33
ccs 8
cts 10
cp 0.8
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getGoutteClient() 0 8 1
A getGenericClient() 0 3 1
A getPhantomJsClient() 0 7 1
1
<?php
2
3
namespace ByTIC\MFinante\Clients;
4
5
use Goutte\Client;
6
7
/**
8
 * Class ClientFactory
9
 * @package ByTIC\MFinante\Clients
10
 */
11
class ClientFactory
12
{
13
    /**
14
     * @return Client
15
     */
16
    public static function getGenericClient()
17
    {
18
        return self::getPhantomJsClient();
19
    }
20
21
    /**
22
     * @return Client
23
     */
24 2
    public static function getGoutteClient()
25
    {
26
        $options = [
27 2
            'headers' => [
28
                'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0',
29
            ],
30
        ];
31 2
        return new Client($options);
32
    }
33
34
    /**
35
     * @return Client
36
     */
37 2
    public static function getPhantomJsClient()
38
    {
39 2
        $client = self::getGoutteClient();
40
41 2
        $phantomJsClient = new PhantomJs\ClientBridge();
42 2
        $client->setClient($phantomJsClient);
43 2
        return $client;
44
    }
45
}
46