Carbon_Breadcrumb_Item_User   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 37
rs 10
c 0
b 0
f 0

3 Methods

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