Carbon_Breadcrumb_Item_DB_Object::setup()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Breadcrumb item in the database.
4
 *
5
 * @package carbon-breadcrumbs
6
 */
7
8
/**
9
 * Breadcrumb item class for objects from the database.
10
 *
11
 * Should be extended by any database object class (for example post, term, user).
12
 */
13
abstract class Carbon_Breadcrumb_Item_DB_Object extends Carbon_Breadcrumb_Item implements Carbon_Breadcrumb_DB_Object {
14
15
	/**
16
	 * ID of the object, associated with this breadcrumb item.
17
	 *
18
	 * @access protected
19
	 * @var int
20
	 */
21
	protected $id = 0;
22
23
	/**
24
	 * Configure the title and link URL by using the specified post ID.
25
	 *
26
	 * @access public
27
	 */
28
	public function setup() {
29
		// Setup item title.
30
		$this->setup_title();
31
32
		// Setup item link.
33
		$this->setup_link();
34
	}
35
36
	/**
37
	 * Retrieve the object ID.
38
	 *
39
	 * @access public
40
	 *
41
	 * @return int $id The ID of the object associated with this breadcrumb item.
42
	 */
43
	public function get_id() {
44
		return $this->id;
45
	}
46
47
	/**
48
	 * Modify the ID of the object associated with this breadcrumb item.
49
	 *
50
	 * @access public
51
	 *
52
	 * @param int $id The new object ID.
53
	 */
54
	public function set_id( $id = 0 ) {
55
		$this->id = $id;
56
	}
57
58
	/**
59
	 * Setup the title of this item.
60
	 *
61
	 * @abstract
62
	 * @access public
63
	 */
64
	abstract public function setup_title();
65
66
	/**
67
	 * Setup the link of this item.
68
	 *
69
	 * @abstract
70
	 * @access public
71
	 */
72
	abstract public function setup_link();
73
74
}
75