Carbon_Pagination_Item_Current_Page_Text   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setup() 0 11 1
A render() 0 8 1
1
<?php
2
/**
3
 * The Carbon Pagination current page item class.
4
 * Responsible for the "Page X of Y" pagination item.
5
 *
6
 * @uses Carbon_Pagination_Item
7
 */
8
class Carbon_Pagination_Item_Current_Page_Text extends Carbon_Pagination_Item {
9
10
	/**
11
	 * Setup the item before rendering.
12
	 * Setup item tokens.
13
	 */
14 2
	public function setup() {
15 2
		$pagination = $this->get_collection()->get_pagination();
16 2
		$current_page = $pagination->get_current_page();
17
18
		$tokens = array(
19 2
			'CURRENT_PAGE' => $current_page,
20 2
			'TOTAL_PAGES' => $pagination->get_total_pages(),
21 2
		);
22
23 2
		$this->set_tokens( $tokens );
24 2
	}
25
26
	/**
27
	 * Render the item.
28
	 *
29
	 * @return string $html The HTML of the item.
30
	 */
31 2
	public function render() {
32 2
		$pagination = $this->get_collection()->get_pagination();
33
34 2
		$html = $pagination->get_current_page_html();
35 2
		$html = apply_filters( 'carbon_pagination_current_page_text', $html, $this );
36
37 2
		return $html;
38
	}
39
40
}