1 | <?php |
||
22 | class DataTablesResponse implements DataTablesResponseInterface, JsonSerializable { |
||
23 | |||
24 | /** |
||
25 | * Data. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | private $data; |
||
30 | |||
31 | /** |
||
32 | * Draw. |
||
33 | * |
||
34 | * @var integer |
||
35 | */ |
||
36 | private $draw; |
||
37 | |||
38 | /** |
||
39 | * Error. |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | private $error; |
||
44 | |||
45 | /** |
||
46 | * Records filtered. |
||
47 | * |
||
48 | * @var integer |
||
49 | */ |
||
50 | private $recordsFiltered; |
||
51 | |||
52 | /** |
||
53 | * Records total. |
||
54 | * |
||
55 | * @var integer |
||
56 | */ |
||
57 | private $recordsTotal; |
||
58 | |||
59 | /** |
||
60 | * Wrapper. |
||
61 | * |
||
62 | * @var DataTablesWrapper |
||
63 | */ |
||
64 | private $wrapper; |
||
65 | |||
66 | /** |
||
67 | * Constructor. |
||
68 | */ |
||
69 | protected function __construct() { |
||
75 | |||
76 | /** |
||
77 | * Add a row. |
||
78 | * |
||
79 | * @return DataTablesResponse Returns this response. |
||
80 | */ |
||
81 | public function addRow() { |
||
96 | |||
97 | /** |
||
98 | * Count rows. |
||
99 | * |
||
100 | * @return integer Returns the rows count. |
||
101 | */ |
||
102 | public function countRows() { |
||
105 | |||
106 | /** |
||
107 | * DataTables rows. |
||
108 | * |
||
109 | * @return array Returns the rows. |
||
110 | */ |
||
111 | public static function dtRows() { |
||
112 | return [ |
||
113 | self::DATATABLES_ROW_ATTR, |
||
114 | self::DATATABLES_ROW_CLASS, |
||
115 | self::DATATABLES_ROW_DATA, |
||
116 | self::DATATABLES_ROW_ID, |
||
117 | ]; |
||
118 | } |
||
119 | |||
120 | /** |
||
121 | * Get the data. |
||
122 | * |
||
123 | * @return array Returns the data. |
||
124 | */ |
||
125 | public function getData() { |
||
128 | |||
129 | /** |
||
130 | * Get the draw |
||
131 | * |
||
132 | * @return integer Returns the draw. |
||
133 | */ |
||
134 | public function getDraw() { |
||
137 | |||
138 | /** |
||
139 | * Get the error. |
||
140 | * |
||
141 | * @return string Returns the error. |
||
142 | */ |
||
143 | public function getError() { |
||
146 | |||
147 | /** |
||
148 | * Get the records filtered. |
||
149 | * |
||
150 | * @return integer The records filtered. |
||
151 | */ |
||
152 | public function getRecordsFiltered() { |
||
155 | |||
156 | /** |
||
157 | * Get the records total. |
||
158 | * |
||
159 | * @return integer Returns the records total. |
||
160 | */ |
||
161 | public function getRecordsTotal() { |
||
164 | |||
165 | /** |
||
166 | * Get the wrapper. |
||
167 | * |
||
168 | * @return DataTablesWrapper Returns the wrapper. |
||
169 | */ |
||
170 | public function getWrapper() { |
||
173 | |||
174 | /** |
||
175 | * {@inheritdoc} |
||
176 | */ |
||
177 | public function jsonSerialize() { |
||
180 | |||
181 | /** |
||
182 | * Create a response instance. |
||
183 | * |
||
184 | * @param DataTablesWrapper $wrapper The wrapper. |
||
185 | * @param DataTablesRequest $request The request. |
||
186 | * @return DataTablesResponse Returns the response. |
||
187 | */ |
||
188 | public static function parse(DataTablesWrapper $wrapper, DataTablesRequest $request) { |
||
198 | |||
199 | /** |
||
200 | * Set the data. |
||
201 | * |
||
202 | * @param array $data The data. |
||
203 | * @return DataTablesResponse Returns this response. |
||
204 | */ |
||
205 | protected function setData(array $data) { |
||
209 | |||
210 | /** |
||
211 | * Set the draw. |
||
212 | * |
||
213 | * @param integer $draw The draw. |
||
214 | * @return DataTablesResponse Returns the response. |
||
215 | */ |
||
216 | protected function setDraw($draw) { |
||
220 | |||
221 | /** |
||
222 | * Set the error. |
||
223 | * |
||
224 | * @param string $error The error. |
||
225 | * @return DataTablesResponse Returns this response. |
||
226 | */ |
||
227 | public function setError($error) { |
||
231 | |||
232 | /** |
||
233 | * Set the records filtered. |
||
234 | * |
||
235 | * @param integer $recordsFiltered The records filtered. |
||
236 | * @return DataTablesResponse Returns this response. |
||
237 | */ |
||
238 | public function setRecordsFiltered($recordsFiltered) { |
||
242 | |||
243 | /** |
||
244 | * Set the records total. |
||
245 | * |
||
246 | * @param integer $recordsTotal The records total. |
||
247 | * @return DataTablesResponse Returns this response. |
||
248 | */ |
||
249 | public function setRecordsTotal($recordsTotal) { |
||
253 | |||
254 | /** |
||
255 | * Set a row value. |
||
256 | * |
||
257 | * @param string $data The column data. |
||
258 | * @param string $value The column value. |
||
259 | * @return DataTablesResponse Returns this response. |
||
260 | */ |
||
261 | public function setRow($data, $value) { |
||
274 | |||
275 | /** |
||
276 | * Set the wrapper. |
||
277 | * |
||
278 | * @param DataTablesWrapper $wrapper The wrapper. |
||
279 | * @return DataTablesResponse Returns this response. |
||
280 | */ |
||
281 | protected function setWrapper(DataTablesWrapper $wrapper) { |
||
285 | |||
286 | /** |
||
287 | * Convert into an array representing this instance. |
||
288 | * |
||
289 | * @return array Returns an array representing this instance. |
||
290 | */ |
||
291 | public function toArray() { |
||
304 | |||
305 | } |
||
306 |