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

PageRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 11
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPage() 0 7 2
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