Completed
Push — master ( 5fe409...71e3f4 )
by Marin
02:59
created

Comment_Meta_Datastore::load()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 18
Code Lines 10

Duplication

Lines 18
Ratio 100 %

Importance

Changes 4
Bugs 1 Features 0
Metric Value
c 4
b 1
f 0
dl 18
loc 18
rs 9.4285
cc 3
eloc 10
nc 2
nop 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A Comment_Meta_Datastore::get_table_name() 0 4 1
A Comment_Meta_Datastore::get_table_field_name() 0 3 1
1
<?php 
2
3
namespace Carbon_Fields\Datastore;
4
5
use Carbon_Fields\Field\Field;
6
7
/**
8
 * Comment meta datastore class.
9
 */
10
class Comment_Meta_Datastore extends Meta_Datastore {
11
	/**
12
	 * ID of the comment.
13
	 *
14
	 * @var int
15
	 */
16
	protected $comment_id;
17
18
	/**
19
	 * Retrieve the type of meta data.
20
	 *
21
	 * @return string
22
	 */
23
	public function get_meta_type() {
24
		return 'comment';
25
	}
26
27
	/**
28
	 * Retrieve the meta table name to query.
29
	 *
30
	 * @return string
31
	 */
32
	public function get_table_name() {
33
		global $wpdb;
34
		return $wpdb->commentmeta;
35
	}
36
37
	/**
38
	 * Retrieve the meta table field name to query by.
39
	 *
40
	 * @return string
41
	 */
42
	public function get_table_field_name() {
43
		return 'comment_id';
44
	}
45
46
	/**
47
	 * Set the comment ID of the datastore.
48
	 *
49
	 * @param int $id ID of the comment.
50
	 */
51
	public function set_id( $id ) {
52
		$this->comment_id = $id;
53
	}
54
55
	/**
56
	 * Retrieve the comment ID of the datastore.
57
	 * 
58
	 * @return int ID of the comment.
59
	 */
60
	public function get_id() {
61
		return $this->comment_id;
62
	}
63
}
64