Carbon_Pagination_Item_Direction_Page   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
c 4
b 0
f 0
dl 0
loc 47
ccs 9
cts 9
cp 1
rs 10
wmc 2
lcom 1
cbo 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 14 2
get_direction_html() 0 1 ?
get_direction_disabled() 0 1 ?
get_direction_page_number() 0 1 ?
1
<?php
2
/**
3
 * The Carbon Pagination direction page item class.
4
 * Used for prev, next, first & last items.
5
 * Should be extended by each one of them.
6
 *
7
 * @abstract
8
 *
9
 * @uses Carbon_Pagination_Item
10
 */
11
abstract class Carbon_Pagination_Item_Direction_Page extends Carbon_Pagination_Item {
12
13
	/**
14
	 * Initialize the item.
15
	 * Generate the sub items of this item.
16
	 */
17 2
	public function init() {
18 2
		$collection = $this->get_collection();
19
20
		// bail if this direction is disabled
21 2
		if ( $this->get_direction_disabled() ) {
22 2
			return;
23
		}
24
25
		// create subitem and its collection and assign it
26 1
		$html = $this->get_direction_html();
27 1
		$page = $this->get_direction_page_number();
28 1
		$subitems_collection = Carbon_Pagination_Item_Page::generate_single_subitem_collection( $collection, $html, $page );
29 1
		$this->set_subitems_collection( $subitems_collection );
30 1
	}
31
32
	/**
33
	 * The HTML of the direction item.
34
	 *
35
	 * @abstract
36
	 * @return string $html The direction item HTML.
37
	 */
38
	abstract public function get_direction_html();
39
	
40
	/**
41
	 * The result of the condition which would disable this item.
42
	 * If true, this item wont be displayed.
43
	 *
44
	 * @abstract
45
	 * @return bool $result The condition result.
46
	 */
47
	abstract public function get_direction_disabled();
48
49
	/**
50
	 * The number of the page to link to.
51
	 *
52
	 * @abstract
53
	 * @return int $page The number of the page to link to.
54
	 */
55
	abstract public function get_direction_page_number();
56
57
}