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

Carbon_Breadcrumb_Item_User::setup()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

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