URLRequest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 12
c 1
b 0
f 0
dl 0
loc 35
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getFormValues() 0 6 1
A addRemoteURLHTTPHeader() 0 4 1
A __construct() 0 4 1
A getPostURL() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TheCodingMachine\Gotenberg;
6
7
final class URLRequest extends ChromeRequest implements GotenbergRequestInterface
8
{
9
    private const REMOTE_URL = 'remoteURL';
10
11
    private const REMOTE_URL_BASE_HTTP_HEADER_KEY = 'Gotenberg-Remoteurl-';
12
13
    /** @var string */
14
    private $URL;
15
16
    public function __construct(string $URL)
17
    {
18
        parent::__construct();
19
        $this->URL = $URL;
20
    }
21
22
    public function getPostURL(): string
23
    {
24
        return '/convert/url';
25
    }
26
27
    /**
28
     * @return array<string,mixed>
29
     */
30
    public function getFormValues(): array
31
    {
32
        $values = parent::getFormValues();
33
        $values[self::REMOTE_URL] = $this->URL;
34
35
        return $values;
36
    }
37
38
    public function addRemoteURLHTTPHeader(string $key, string $value): void
39
    {
40
        $key = self::REMOTE_URL_BASE_HTTP_HEADER_KEY . $key;
41
        $this->customHTTPHeaders[$key] = $value;
42
    }
43
}
44