Passed
Pull Request — master (#87)
by Dmitriy
02:45
created

Request   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPage() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Infrastructure\IO\Http\Blog\GetIndex\Request;
6
7
use OpenApi\Annotations as OA;
8
use Yiisoft\RequestModel\RequestModel;
9
10
/**
11
 * @OA\Parameter(
12
 *      @OA\Schema(
13
 *          type="int",
14
 *          example="2"
15
 *      ),
16
 *      in="query",
17
 *      name="page",
18
 *      parameter="BlogIndexRequest"
19
 * )
20
 */
21
final class Request extends RequestModel
22
{
23
    private const DEFAULT_PAGE_PARAM = 1;
24
25 1
    public function getPage(): int
26
    {
27 1
        if ($this->hasAttribute('query.page')) {
28 1
            return (int)$this->getAttributeValue('query.page');
29
        }
30
31
        return self::DEFAULT_PAGE_PARAM;
32
    }
33
}
34