Completed
Branch BETA-4.9-messages-queue-fixed (941081)
by
unknown
30:24 queued 05:56
created

EE_Post_Meta   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 102
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1
Metric Value
wmc 11
lcom 2
cbo 1
dl 0
loc 102
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A new_instance() 0 4 2
A new_instance_from_db() 0 3 1
A meta_id() 0 3 1
A set_meta_id() 0 3 1
A post_id() 0 3 1
A set_post_id() 0 3 1
A meta_key() 0 3 1
A set_meta_key() 0 3 1
A meta_value() 0 3 1
A set_meta_value() 0 3 1
1
<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
	exit( 'No direct script access allowed' );
3
}
4
/**
5
 * Event Espresso
6
 *
7
 * Event Registration and Management Plugin for WordPress
8
 *
9
 * @ package 		Event Espresso
10
 * @ author 		Event Espresso
11
 * @ copyright 	(c) 2008-2011 Event Espresso  All Rights Reserved.
12
 * @ license 		{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing *
13
 * @ link 				{@link http://www.eventespresso.com}
14
 * @ since 			4.0
15
 *
16
 */
17
18
19
20
/**
21
 * EE_Post_Meta class
22
 *
23
 * @package 			Event Espresso
24
 * @subpackage 	includes/classes/EE_Answer.class.php
25
 * @author 				Mike Nelson
26
 */
27
class EE_Post_Meta extends EE_Base_Class {
28
29
	/**
30
	 * @param array $props_n_values
31
	 * @return EE_Post_Meta|mixed
32
	 */
33
	public static function new_instance( $props_n_values = array() ) {
34
		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (_check_for_object() instead of new_instance()). Are you sure this is correct? If so, you might want to change this to $this->_check_for_object().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
35
		return $has_object ? $has_object : new self( $props_n_values );
36
	}
37
38
39
40
	/**
41
	 * @param array $props_n_values
42
	 * @return EE_Post_Meta
43
	 */
44
	public static function new_instance_from_db( $props_n_values = array() ) {
45
		return new self( $props_n_values, TRUE );
46
	}
47
48
49
50
	/**
51
	 * Gets meta_id
52
	 * @return int
53
	 */
54
	function meta_id() {
55
		return $this->get( 'meta_id' );
56
	}
57
58
59
60
	/**
61
	 * Sets meta_id
62
	 * @param int $meta_id
63
	 * @return boolean
64
	 */
65
	function set_meta_id( $meta_id) {
66
		return $this->set( 'meta_id', $meta_id);
67
	}
68
	/**
69
	 * Gets post_id
70
	 * @return int
71
	 */
72
	function post_id() {
73
		return $this->get( 'post_id' );
74
	}
75
76
77
78
	/**
79
	 * Sets post_id
80
	 * @param int $post_id
81
	 * @return boolean
82
	 */
83
	function set_post_id( $post_id) {
84
		return $this->set( 'post_id', $post_id);
85
	}
86
	/**
87
	 * Gets meta_key
88
	 * @return string
89
	 */
90
	function meta_key() {
91
		return $this->get( 'meta_key' );
92
	}
93
94
95
96
	/**
97
	 * Sets meta_key
98
	 * @param string $meta_key
99
	 * @return boolean
100
	 */
101
	function set_meta_key( $meta_key) {
102
		return $this->set( 'meta_key', $meta_key);
103
	}
104
	/**
105
	 * Gets meta_value
106
	 * @return mixed
107
	 */
108
	function meta_value() {
109
		return $this->get( 'meta_value' );
110
	}
111
112
113
114
	/**
115
	 * Sets meta_value
116
	 * @param mixed $meta_value
117
	 * @return boolean
118
	 */
119
	function set_meta_value( $meta_value) {
120
		return $this->set( 'meta_value', $meta_value);
121
	}
122
123
124
125
126
127
128
}
129
/* End of file EE_Post_Meta.class.php */
130
/* Location: /includes/classes/EE_Answer.class.php */