Carbon_Pagination_Item_Direction_Forward_Page   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 6
Bugs 0 Features 0
Metric Value
c 6
b 0
f 0
dl 0
loc 23
ccs 7
cts 7
cp 1
rs 10
wmc 2
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A get_direction_disabled() 0 14 2
1
<?php
2
/**
3
 * The Carbon Pagination direction forward page item class.
4
 * Used for next & last items.
5
 * Should be extended by each one of them.
6
 *
7
 * @abstract
8
 *
9
 * @uses Carbon_Pagination_Item_Direction_Page
10
 */
11
abstract class Carbon_Pagination_Item_Direction_Forward_Page extends Carbon_Pagination_Item_Direction_Page {
12
13
	/**
14
	 * If on the last page, the next and last items should be disabled.
15
	 *
16
	 * @return bool $result The condition result.
17
	 */
18 3
	public function get_direction_disabled() {
19 3
		$pagination = $this->get_collection()->get_pagination();
20
21
		// get various pagination variables that we need
22 3
		$current_page_idx = $pagination->get_current_page() - 1;
23 3
		$total_pages = $pagination->get_total_pages();
24
25
		// bail if there is no previous page
26 3
		if ( $current_page_idx >= $total_pages - 1 ) {
27 1
			return true;
28
		}
29
30 3
		return false;
31
	}
32
33
}