CollectionApiResponse::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
ccs 6
cts 6
cp 1
rs 9.4285
cc 2
eloc 5
nc 2
nop 5
crap 2
1
<?php
2
3
namespace AppBundle\Response;
4
5
/**
6
 * @author Vehsamrak
7
 */
8
class CollectionApiResponse extends ApiResponse
9
{
10
11
    const DEFAULT_LIMIT = 50;
12
13
    /** @var int */
14
    private $total;
15
16
    /** @var int */
17
    private $limit;
18
19
    /** @var int */
20
    private $offset;
21
22 8
    public function __construct($data, int $httpCode, int $total, int $limit = 50, int $offset = 0)
23
    {
24 8
        parent::__construct($data, $httpCode);
25
26 8
        $this->total = $total;
27 8
        $this->limit = $limit ?: self::DEFAULT_LIMIT;
28 8
        $this->offset = $offset;
29 8
    }
30
}
31