Total Complexity | 11 |
Total Lines | 127 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | final class Pagination |
||
12 | { |
||
13 | /** |
||
14 | * @var int |
||
15 | */ |
||
16 | private $total = 0; |
||
17 | |||
18 | /** |
||
19 | * @var int |
||
20 | */ |
||
21 | private $size = 0; |
||
22 | |||
23 | /** |
||
24 | * @var int |
||
25 | */ |
||
26 | private $prev = 1; |
||
27 | |||
28 | /** |
||
29 | * @var int |
||
30 | */ |
||
31 | private $page = 1; |
||
32 | |||
33 | /** |
||
34 | * @var int |
||
35 | */ |
||
36 | private $next = 1; |
||
37 | |||
38 | /** |
||
39 | * @var int |
||
40 | */ |
||
41 | private $last = 1; |
||
42 | |||
43 | /** |
||
44 | * @var array |
||
45 | */ |
||
46 | private $items = []; |
||
47 | |||
48 | /** |
||
49 | * Pagination constructor. |
||
50 | * @param int $total |
||
51 | * @param int $size |
||
52 | * @param int $prev |
||
53 | * @param int $page |
||
54 | * @param int $next |
||
55 | * @param int $last |
||
56 | * @param array $items |
||
57 | */ |
||
58 | public function __construct(int $total, int $size, int $prev, int $page, int $next, int $last, array $items) |
||
59 | { |
||
60 | $this->total = $total; |
||
61 | $this->size = $size; |
||
62 | $this->prev = $prev; |
||
63 | $this->page = $page; |
||
64 | $this->next = $next; |
||
65 | $this->last = $last; |
||
66 | $this->items = $items; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @return int |
||
71 | */ |
||
72 | public function total() : int |
||
73 | { |
||
74 | return $this->total; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @return int |
||
79 | */ |
||
80 | public function size() : int |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * @return int |
||
87 | */ |
||
88 | public function prev() : int |
||
89 | { |
||
90 | return $this->prev; |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * @return int |
||
95 | */ |
||
96 | public function page() : int |
||
97 | { |
||
98 | return $this->page; |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * @return int |
||
103 | */ |
||
104 | public function next() : int |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * @return int |
||
111 | */ |
||
112 | public function last() : int |
||
113 | { |
||
114 | return $this->last; |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * @return array |
||
119 | */ |
||
120 | public function items() : array |
||
121 | { |
||
122 | return $this->items; |
||
123 | } |
||
124 | |||
125 | /** |
||
126 | * @param object $target |
||
127 | * @return mixed |
||
128 | */ |
||
129 | public function export(object $target) : object |
||
138 | } |
||
139 | } |
||
140 |