ClientFactory::getGenericClient()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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