Paginator::default()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zing\QueryBuilder;
6
7
class Paginator
8
{
9
    /**
10
     * @var string
11
     */
12
    private $name;
13
14
    /**
15
     * @var int
16
     */
17
    private $default;
18
19 7
    public function __construct(?string $name = null, ?int $default = null)
20
    {
21 7
        $this->name = $name ?: QueryConfiguration::getPageName();
22 7
        $this->default = $default ?: QueryConfiguration::getPerPage();
23
    }
24
25 7
    public static function name(?string $name = null, ?int $default = null): self
26
    {
27 7
        return new self($name, $default);
28
    }
29
30 2
    public function default(int $default): self
31
    {
32 2
        $this->default = $default;
33
34 2
        return $this;
35
    }
36
37 7
    public function getName(): string
38
    {
39 7
        return $this->name;
40
    }
41
42 3
    public function getDefault(): int
43
    {
44 3
        return $this->default;
45
    }
46
}
47