Passed
Push — master ( 7c54d7...41926f )
by Zing
05:15
created

Paginator::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
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
use function config;
8
9
class Paginator
10
{
11
    /**
12
     * @var string
13
     */
14
    private $name;
15
16
    /**
17
     * @var int
18
     */
19
    private $default;
20
21 4
    public function __construct(?string $name = null, ?int $default = null)
22
    {
23 4
        $this->name = $name ?: (string) config('query-builder.per_page.key');
24 4
        $this->default = $default ?: (int) config('query-builder.per_page.value');
25 4
    }
26
27 4
    public static function name(?string $name = null, ?int $default = null): self
28
    {
29 4
        return new self($name, $default);
30
    }
31
32 1
    public function default(int $default): self
33
    {
34 1
        $this->default = $default;
35
36 1
        return $this;
37
    }
38
39 4
    public function getName(): string
40
    {
41 4
        return $this->name;
42
    }
43
44 4
    public function getDefault(): int
45
    {
46 4
        return $this->default;
47
    }
48
}
49