Completed
Push — master ( 2b661c...5d79c3 )
by Marin
02:11
created

Carbon_Breadcrumb_Item_User   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 36
ccs 12
cts 12
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setup_title() 0 4 1
A setup_link() 0 3 1
A setup() 0 8 2
1
<?php
2
/**
3
 * Breadcrumb item class for author archives.
4
 *
5
 * Used for breadcrumb items that represent a certain author archive page.
6
 */
7
class Carbon_Breadcrumb_Item_User extends Carbon_Breadcrumb_Item_DB_Object {
8
9
	/**
10
	 * Configure the title and link URL by using the specified author user ID.
11
	 *
12
	 * @access public
13
	 */
14 2
	public function setup() {
15
		// in order to continue, author user ID must be specified
16 2
		if ( ! $this->get_id() ) {
17 1
			throw new Carbon_Breadcrumb_Exception( 'The author breadcrumb items must have author ID specified.' );
18
		}
19
20 1
		parent::setup();
21 1
	}
22
23
	/**
24
	 * Setup the title of this item.
25
	 *
26
	 * @access public
27
	 */
28 1
	public function setup_title() {
29 1
		$title = apply_filters( 'the_title', get_the_author_meta( 'display_name', $this->get_id() ) );
30 1
		$this->set_title( $title );
31 1
	}
32
33
	/**
34
	 * Setup the link of this item.
35
	 *
36
	 * @access public
37
	 */
38 1
	public function setup_link() {
39 1
		$this->set_link( get_author_posts_url( $this->get_id() ) );
40 1
	}
41
42
}