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

Carbon_Breadcrumb_Item_User::setup_link()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
dl 0
loc 3
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
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
}