Paginator   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 38
ccs 12
cts 12
cp 1
rs 10
c 1
b 0
f 0
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A name() 0 3 1
A default() 0 5 1
A getDefault() 0 3 1
A getName() 0 3 1
A __construct() 0 4 3
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