Completed
Push — master ( 975fd1...3e68e7 )
by J.D.
03:16
created

WordPoints_Hook_Reaction::get_id()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * Hook reaction class.
5
 *
6
 * @package wordpoints-hooks-api
7
 * @since 1.0.0
8
 */
9
10
/**
11
 * Bootstrap for representing a hook reaction.
12
 *
13
 * @since 1.0.0
14
 */
15
abstract class WordPoints_Hook_Reaction implements WordPoints_Hook_ReactionI {
16
17
	/**
18
	 * @since 1.0.0
19
	 */
20
	protected $ID;
21
22
	/**
23
	 * The reaction storage object.
24
	 *
25
	 * @since 1.0.0
26
	 *
27
	 * @var WordPoints_Hook_Reaction_StoreI
28
	 */
29
	protected $store;
30
31
	//
32
	// Public Methods.
33
	//
34
35
	/**
36
	 * Construct the class for a hook reaction.
37
	 *
38
	 * @since 1.0.0
39
	 *
40
	 * @param int                             $id    The ID of a hook reaction.
41
	 * @param WordPoints_Hook_Reaction_StoreI $store The storage object.
42
	 */
43
	public function __construct( $id, WordPoints_Hook_Reaction_StoreI $store ) {
44
45
		$this->ID    = wordpoints_int( $id );
46
		$this->store = $store;
47
	}
48
49
	/**
50
	 * @since 1.0.0
51
	 */
52
	public function get_id() {
53
		return $this->ID;
54
	}
55
56
	/**
57
	 * @since 1.0.0
58
	 */
59
	public function get_guid() {
60
61
		return array(
62
			'id' => $this->ID,
63
			'store' => $this->get_store_slug(),
64
			'context_id' => $this->get_context_id(),
65
		);
66
	}
67
68
	/**
69
	 * @since 1.0.0
70
	 */
71
	public function get_reactor_slug() {
72
		return $this->get_meta( 'reactor' );
73
	}
74
75
	/**
76
	 * @since 1.0.0
77
	 */
78
	public function get_store_slug() {
79
		return $this->store->get_slug();
80
	}
81
82
	/**
83
	 * @since 1.0.0
84
	 */
85
	public function get_context_id() {
86
		return $this->store->get_context_id();
87
	}
88
}
89
90
// EOF
91