InsightsRequest::buildHeaders()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
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
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Request;
6
7
use Kerox\Messenger\Helper\UtilityTrait;
8
9
class InsightsRequest extends AbstractRequest
10
{
11
    use UtilityTrait;
12
13
    /**
14
     * @var array
15
     */
16
    protected $metrics;
17
18
    /**
19
     * @var int|null
20
     */
21
    protected $since;
22
23
    /**
24
     * @var int|null
25
     */
26
    protected $until;
27
28
    /**
29
     * UserRequest constructor.
30
     */
31 1
    public function __construct(string $pageToken, array $metrics, ?int $since = null, ?int $until = null)
32
    {
33 1
        parent::__construct($pageToken);
34
35 1
        $this->metrics = $metrics;
36 1
        $this->since = $since;
37 1
        $this->until = $until;
38 1
    }
39
40 1
    protected function buildHeaders(): void
41
    {
42 1
    }
43
44 1
    protected function buildBody(): void
45
    {
46 1
    }
47
48 1
    protected function buildQuery(): array
49
    {
50 1
        $metrics = implode(',', $this->metrics);
51
52 1
        $query = parent::buildQuery();
53
        $query += [
54 1
            'metric' => $metrics,
55 1
            'since' => $this->since,
56 1
            'until' => $this->until,
57
        ];
58
59 1
        return $this->arrayFilter($query);
60
    }
61
}
62