WordPoints_BP_Entity_Message::get_entity()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Message entity class.
5
 *
6
 * @package WordPoints_BuddyPress
7
 * @since 1.0.0
8
 */
9
10
/**
11
 * Represents a BuddyPress message.
12
 *
13
 * @since 1.0.0
14
 */
15 View Code Duplication
class WordPoints_BP_Entity_Message extends WordPoints_BP_Entity {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
16
17
	/**
18
	 * @since 1.0.0
19
	 */
20
	protected $bp_component = 'messages';
21
22
	/**
23
	 * @since 1.0.0
24
	 */
25
	protected $bp_component_table_name = 'messages';
26
27
	/**
28
	 * @since 1.0.0
29
	 */
30
	protected $id_field = 'id';
31
32
	/**
33
	 * @since 1.2.1
34
	 */
35
	protected $id_is_int = true;
36
37
	/**
38
	 * @since 1.0.0
39
	 */
40
	protected $human_id_field = 'subject';
41
42
	/**
43
	 * @since 1.0.0
44
	 */
45
	protected function get_entity( $id ) {
46
47
		$entity = new BP_Messages_Message( $id );
48
49
		if ( ! $entity->id ) {
50
			return false;
51
		}
52
53
		return $entity;
54
	}
55
56
	/**
57
	 * @since 1.0.0
58
	 */
59
	public function get_title() {
60
		return _x( 'Message', 'message entity', 'wordpoints-bp' );
61
	}
62
}
63
64
// EOF
65