Test Failed
Push — master ( 09a5f1...c566a2 )
by Alexander
12:51
created

PageRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 2
b 0
f 0
dl 0
loc 11
rs 10

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
use OpenApi\Annotations as OA;
9
10
/**
11
 * @OA\Parameter(
12
 *      @OA\Schema(
13
 *          type="int",
14
 *          example="2"
15
 *      ),
16
 *      in="query",
17
 *      name="page",
18
 *      parameter="PageRequest"
19
 * )
20
 */
21
final class PageRequest extends RequestModel
22
{
23
    private const DEFAULT_PAGE_PARAM = 1;
24
25
    public function getPage(): int
26
    {
27
        if ($this->hasAttribute('query.page')) {
28
            return (int)$this->getAttributeValue('query.page');
29
        }
30
31
        return self::DEFAULT_PAGE_PARAM;
32
    }
33
}
34