@@ 101-108 (lines=8) @@ | ||
98 | * |
|
99 | * @return Pagination A self instance for method chain calls |
|
100 | */ |
|
101 | public function setCurrent($value) |
|
102 | { |
|
103 | if (StaticValidator::validates('number', $value)) { |
|
104 | $this->current = StaticFilter::filter('number',$value); |
|
105 | $this->offset = $this->rowsPerPage * ($this->current - 1); |
|
106 | } |
|
107 | return $this; |
|
108 | } |
|
109 | ||
110 | /** |
|
111 | * Sets the total rows to paginate. |
|
@@ 117-124 (lines=8) @@ | ||
114 | * |
|
115 | * @return Pagination A self instance for method chain calls |
|
116 | */ |
|
117 | public function setTotal($value) |
|
118 | { |
|
119 | if (StaticValidator::validates('number', $value)) { |
|
120 | $this->total = StaticFilter::filter('number',$value); |
|
121 | $this->pages = ceil($this->total / $this->rowsPerPage); |
|
122 | } |
|
123 | return $this; |
|
124 | } |
|
125 | ||
126 | /** |
|
127 | * Sets the total rows per page. |
|
@@ 133-140 (lines=8) @@ | ||
130 | * |
|
131 | * @return Pagination A self instance for method chain calls |
|
132 | */ |
|
133 | public function setRowsPerPage($value) |
|
134 | { |
|
135 | if (StaticValidator::validates('number', $value)) { |
|
136 | $this->rowsPerPage = StaticFilter::filter('number',$value); |
|
137 | $this->pages = ceil($this->total / $this->rowsPerPage); |
|
138 | } |
|
139 | return $this; |
|
140 | } |
|
141 | ||
142 | /** |
|
143 | * Creates a request query for the provided page. |