Passed
Pull Request — master (#26)
by
unknown
05:50 queued 02:30
created

PageRequest::getPage()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2.0625
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Blog;
6
7
use Yiisoft\RequestModel\RequestModel;
8
9
final class PageRequest extends RequestModel
10
{
11
    private const DEFAULT_PAGE_PARAM = 1;
12
13 1
    public function getPage(): int
14
    {
15 1
        if ($this->hasValue('query.page')) {
16 1
            return (int)$this->getValue('query.page');
17
        }
18
19
        return self::DEFAULT_PAGE_PARAM;
20
    }
21
}
22