Passed
Push — master ( 0235c3...d95c9b )
by Milroy
12:19
created

InteractWithQueryString::paginationParams()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace ApiChef\RequestToEloquent;
4
5
use ApiChef\RequestQueryHelper\Fields;
6
use ApiChef\RequestQueryHelper\PaginationParams;
7
use ApiChef\RequestQueryHelper\QueryParamBag;
8
use ApiChef\RequestQueryHelper\Sorts;
9
10
trait InteractWithQueryString
11
{
12
    private ?QueryStringParams $queryStringParams = null;
13
14
    private function getQueryStringParams(): QueryStringParams
15
    {
16
        if ($this->queryStringParams === null) {
17
            $this->queryStringParams = resolve(QueryStringParams::class);
18
        }
19
20
        return $this->queryStringParams;
21
    }
22
23
    private function paginationParams(): PaginationParams
24
    {
25
        return $this->getQueryStringParams()->paginationParams;
26
    }
27
28
    private function includes(): QueryParamBag
29
    {
30
        return $this->getQueryStringParams()->includes;
31
    }
32
33
    private function filters(): QueryParamBag
34
    {
35
        return $this->getQueryStringParams()->filters;
36
    }
37
38
    private function sorts(): Sorts
39
    {
40
        return $this->getQueryStringParams()->sorts;
41
    }
42
43
    private function fields(): Fields
44
    {
45
        return $this->getQueryStringParams()->fields;
46
    }
47
}
48