Code Duplication    Length = 15-21 lines in 5 locations

includes/admin/class-api-keys-table.php 1 location

@@ 336-356 (lines=21) @@
333
	 * @since  1.1
334
	 * @return void
335
	 */
336
	public function prepare_items() {
337
		$columns = $this->get_columns();
338
339
		$hidden   = array(); // No hidden columns
340
		$sortable = array(); // Not sortable... for now
341
342
		$this->_column_headers = array( $columns, $hidden, $sortable );
343
344
		$data = $this->query();
345
346
		$total_items = $this->total_items();
347
348
		$this->items = $data;
349
350
		$this->set_pagination_args( array(
351
				'total_items' => $total_items,
352
				'per_page'    => $this->per_page,
353
				'total_pages' => ceil( $total_items / $this->per_page ),
354
			)
355
		);
356
	}
357
}
358

includes/admin/reports/class-form-reports-table.php 1 location

@@ 337-351 (lines=15) @@
334
	 *
335
	 * @return void
336
	 */
337
	public function prepare_items() {
338
		$columns = $this->get_columns();
339
		$hidden = array(); // No hidden columns
340
		$sortable = $this->get_sortable_columns();
341
		$this->_column_headers = array( $columns, $hidden, $sortable );
342
		$this->items = $this->reports_data();
343
		$total_items = $this->count;
344
345
		$this->set_pagination_args( array(
346
				'total_items' => $total_items,
347
				'per_page'    => $this->per_page,
348
				'total_pages' => ceil( $total_items / $this->per_page )
349
			)
350
		);
351
	}
352
}
353

includes/admin/tools/logs/class-api-requests-logs-list-table.php 1 location

@@ 371-385 (lines=15) @@
368
	 *
369
	 * @return void
370
	 */
371
	public function prepare_items() {
372
		$columns               = $this->get_columns();
373
		$hidden                = array(); // No hidden columns
374
		$sortable              = $this->get_sortable_columns();
375
		$this->_column_headers = array( $columns, $hidden, $sortable );
376
		$this->items           = $this->get_logs();
377
		$total_items           = Give()->logs->get_log_count( 0, 'api_request' );
378
379
		$this->set_pagination_args( array(
380
				'total_items' => $total_items,
381
				'per_page'    => $this->per_page,
382
				'total_pages' => ceil( $total_items / $this->per_page ),
383
			)
384
		);
385
	}
386
}
387

includes/admin/tools/logs/class-gateway-error-logs-list-table.php 1 location

@@ 256-271 (lines=16) @@
253
	 * @uses   Give_Gateway_Error_Log_Table::get_log_count()
254
	 * @return void
255
	 */
256
	public function prepare_items() {
257
258
		$columns               = $this->get_columns();
259
		$hidden                = array(); // No hidden columns
260
		$sortable              = $this->get_sortable_columns();
261
		$this->_column_headers = array( $columns, $hidden, $sortable );
262
		$this->items           = $this->get_logs();
263
		$total_items           = Give()->logs->get_log_count( 0, 'gateway_error' );
264
265
		$this->set_pagination_args( array(
266
				'total_items' => $total_items,
267
				'per_page'    => $this->per_page,
268
				'total_pages' => ceil( $total_items / $this->per_page ),
269
			)
270
		);
271
	}
272
}
273

includes/admin/tools/logs/class-update-logs-list-table.php 1 location

@@ 253-267 (lines=15) @@
250
	 *
251
	 * @return void
252
	 */
253
	public function prepare_items() {
254
		$columns               = $this->get_columns();
255
		$hidden                = array(); // No hidden columns
256
		$sortable              = $this->get_sortable_columns();
257
		$this->_column_headers = array( $columns, $hidden, $sortable );
258
		$this->items           = $this->get_logs();
259
		$total_items           = Give()->logs->get_log_count( 0, 'update' );
260
261
		$this->set_pagination_args( array(
262
				'total_items' => $total_items,
263
				'per_page'    => $this->per_page,
264
				'total_pages' => ceil( $total_items / $this->per_page ),
265
			)
266
		);
267
	}
268
}
269