ContentCollection   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
dl 0
loc 53
ccs 8
cts 16
cp 0.5
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 6 1
A getNext() 0 3 1
A getTotal() 0 3 1
A getData() 0 3 1
A __construct() 0 3 1
A getOffset() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace CCT\Kong\Model\Response;
6
7
class ContentCollection
8
{
9
    /**
10
     * @var int
11
     */
12
    protected $total;
13
14
    /**
15
     * @var object[]
16
     */
17
    protected $data;
18
19
    /**
20
     * @var string|null
21
     */
22
    protected $next;
23
24
    /**
25
     * @var string|null
26
     */
27
    protected $offset;
28
29 5
    public function __construct(array $data)
30
    {
31 5
        $this->normalize($data);
32 5
    }
33
34
    public function getTotal(): int
35
    {
36
        return $this->total;
37
    }
38
39
    public function getNext(): ?string
40
    {
41
        return $this->next;
42
    }
43
44
    public function getOffset(): ?string
45
    {
46
        return $this->offset;
47
    }
48
49
    public function getData()
50
    {
51
        return $this->data;
52
    }
53
54 5
    protected function normalize(array $data)
55
    {
56 5
        $this->data = $data['data'];
57 5
        $this->total = $data['total'];
58 5
        $this->next = $data['next'] ?? null;
59 5
        $this->offset = $data['offset'] ?? null;
60 5
    }
61
}
62