Passed
Push — master ( c39fb6...9e9a0d )
by Rafael
04:42
created

PaginationRequest::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 4
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Pagination;
12
13
/**
14
 * PaginationRequest
15
 */
16
class PaginationRequest
17
{
18
    /**
19
     * @var int
20
     */
21
    protected $first;
22
23
    /**
24
     * @var int
25
     */
26
    protected $last;
27
28
    /**
29
     * @var string
30
     */
31
    protected $after;
32
33
    /**
34
     * @var string
35
     */
36
    protected $before;
37
38
    /**
39
     * PaginationRequest constructor.
40
     *
41
     * @param string $first
42
     * @param string $last
43
     * @param string $after
44
     * @param string $before
45
     */
46 10
    public function __construct($first, $last, $after, $before)
47
    {
48 10
        $this->first = $first;
0 ignored issues
show
Documentation Bug introduced by
The property $first was declared of type integer, but $first is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
49 10
        $this->last = $last;
0 ignored issues
show
Documentation Bug introduced by
The property $last was declared of type integer, but $last is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
50 10
        $this->after = $after;
51 10
        $this->before = $before;
52 10
    }
53
54
    /**
55
     * @return int
56
     */
57 10
    public function getFirst(): ?int
58
    {
59 10
        return $this->first;
60
    }
61
62
    /**
63
     * @param int $first
64
     *
65
     * @return PaginationRequest
66
     */
67
    public function setFirst(int $first): PaginationRequest
68
    {
69
        $this->first = $first;
70
71
        return $this;
72
    }
73
74
    /**
75
     * @return int
76
     */
77 10
    public function getLast(): ?int
78
    {
79 10
        return $this->last;
80
    }
81
82
    /**
83
     * @param int $last
84
     *
85
     * @return PaginationRequest
86
     */
87
    public function setLast(int $last): PaginationRequest
88
    {
89
        $this->last = $last;
90
91
        return $this;
92
    }
93
94
    /**
95
     * @return string
96
     */
97 8
    public function getAfter(): ?string
98
    {
99 8
        return $this->after;
100
    }
101
102
    /**
103
     * @param string $after
104
     *
105
     * @return PaginationRequest
106
     */
107
    public function setAfter(string $after): PaginationRequest
108
    {
109
        $this->after = $after;
110
111
        return $this;
112
    }
113
114
    /**
115
     * @return string
116
     */
117 10
    public function getBefore(): ?string
118
    {
119 10
        return $this->before;
120
    }
121
122
    /**
123
     * @param string $before
124
     *
125
     * @return PaginationRequest
126
     */
127
    public function setBefore(string $before): PaginationRequest
128
    {
129
        $this->before = $before;
130
131
        return $this;
132
    }
133
}
134