Passed
Push — next ( d904ac...c0af08 )
by Bas
13:43
created

HttpRequestOptions   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 43
ccs 6
cts 9
cp 0.6667
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addHeader() 0 3 1
A all() 0 5 1
A toArray() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ArangoClient\Http;
6
7
use GuzzleHttp\HandlerStack;
8
use Spatie\DataTransferObject\FlexibleDataTransferObject;
9
10
/**
11
 * Class HttpRequestOptions
12
 *
13
 * @package ArangoClient\Http
14
 */
15
class HttpRequestOptions extends FlexibleDataTransferObject
16
{
17
    /**
18
     * @var array<mixed>|string|null
19
     */
20
    public $query;
21
22
    /**
23
     * @var array<mixed>|null
24
     */
25
    public ?array $headers = null;
26
27
    public ?string $body = null;
28
29
    public ?HandlerStack $handler = null;
30
31
    /**
32
     * @param  string  $key
33
     * @param mixed $value
34
     */
35 1
    public function addHeader(string $key, $value): void
36
    {
37 1
        $this->headers[$key] = $value;
38 1
    }
39
40
    /**
41
     * @return array<mixed>
42
     */
43 91
    public function all(): array
44
    {
45 91
        $array = parent::all();
46
47 91
        return array_filter($array);
48
    }
49
50
    /**
51
     * @return array<mixed>
52
     */
53
    public function toArray(): array
54
    {
55
        $array = parent::toArray();
56
57
        return array_filter($array);
58
    }
59
}
60