PrerenderIoClient   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 31
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
1
<?php
2
3
namespace MediaMonks\Crawler\Client;
4
5
use Symfony\Component\BrowserKit\History;
6
use Symfony\Component\BrowserKit\CookieJar;
7
8
class PrerenderIoClient extends PrerenderClient
9
{
10
    const URL = 'https://service.prerender.io/';
11
12
    const HEADER_TOKEN = 'HTTP_X-Prerender-Token';
13
    const HEADER_USER_AGENT = 'HTTP_USER_AGENT';
14
15
    const USER_AGENT = 'MediaMonks Crawler';
16
17
    /**
18
     * @var string
19
     */
20
    protected $token;
21
22
    /**
23
     * @param string $token Token from the prerender.io service
24
     * @param array $server The server parameters (equivalent of $_SERVER)
25
     * @param History $history A History instance to store the browser history
26
     * @param CookieJar $cookieJar A CookieJar instance to store the cookies
27
     */
28 2
    public function __construct($token, array $server = [], History $history = null, CookieJar $cookieJar = null)
29
    {
30 2
        $this->token = $token;
31
32 2
        $server[self::HEADER_TOKEN] = $token;
33 2
        $server[self::HEADER_USER_AGENT] = self::USER_AGENT;
34
35 2
        parent::__construct(self::URL, $server, $history, $cookieJar);
36 2
    }
37
38
}
39