ClientFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 32
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

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