InsightsRequest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 53
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A buildHeaders() 0 3 1
A buildBody() 0 3 1
A buildQuery() 0 13 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