ClientFactory::getGenericClient()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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