Completed
Branch BUG-9019-ticket-selector-submi... (c1f9d8)
by
unknown
435:14 queued 416:01
created

EE_Response   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 117
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 0
Metric Value
wmc 10
lcom 3
cbo 0
dl 0
loc 117
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A set_notice() 0 3 1
A get_notice() 0 3 2
A get_notices() 0 3 1
A add_output() 0 3 2
A get_output() 0 3 1
A request_terminated() 0 3 1
A terminate_request() 0 3 1
1
<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
/**
3
 * class EE_Response
4
 *
5
 * Passes output, notices, and request termination status between EE_Middleware classes
6
 *
7
 * @package         Event Espresso
8
 * @subpackage  /core/
9
 * @author          Brent Christensen
10
 *
11
 * ------------------------------------------------------------------------
12
 */
13
class EE_Response {
14
15
	/**
16
	 * @access 	protected
17
	 * @type 		array $_notice
18
	 */
19
	protected $_notice = array();
20
21
	/**
22
	 *    rendered output to be returned to WP
23
	 * @access 	protected
24
	 * @type 		string
25
	 */
26
	protected $_output = '';
27
28
	/**
29
	 * @access 	protected
30
	 * @type 		bool
31
	 */
32
	protected $request_terminated = false;
33
34
35
36
	/**
37
	 *    class constructor
38
	 *
39
	 * @access    public
40
	 * @return \EE_Response
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
41
	 */
42
	public function __construct() {
43
		$this->terminate_request( false );
44
	}
45
46
47
48
	/**
49
	 *    set_notice
50
	 *
51
	 * @access    public
52
	 * @param $key
53
	 * @param $value
54
	 * @return    void
55
	 */
56
	public function set_notice( $key, $value ) {
57
		$this->_notice[ $key ] = $value;
58
	}
59
60
61
62
	/**
63
	 *    get_notice
64
	 *
65
	 * @access    public
66
	 * @param $key
67
	 * @return    mixed
68
	 */
69
	public function get_notice( $key ) {
70
		return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : NULL;
71
	}
72
73
74
75
	/**
76
	 *    get_notices
77
	 *
78
	 * @access    public
79
	 * @return    array
80
	 */
81
	public function get_notices() {
82
		return $this->_notice;
83
	}
84
85
86
87
	/**
88
	 *    add_output
89
	 *
90
	 * @access    public
91
	 * @param $string
92
	 * @param bool $append
93
	 */
94
	public function add_output( $string, $append = true ) {
95
		$this->_output = $append ? $this->_output . $string : $string . $this->_output;
96
	}
97
98
99
100
	/**
101
	 * 	get_output
102
	 *
103
	 *  @access 	public
104
	 *  @return 	string
105
	 */
106
	public function get_output() {
107
		return $this->_output;
108
	}
109
110
111
112
	/**
113
	 * @return boolean
114
	 */
115
	public function request_terminated() {
116
		return $this->request_terminated;
117
	}
118
119
120
121
	/**
122
	 * @param boolean $request_terminated
123
	 */
124
	public function terminate_request( $request_terminated = true ) {
125
		$this->request_terminated = filter_var( $request_terminated, FILTER_VALIDATE_BOOLEAN );
126
	}
127
128
129
}
130
// End of file EE_Response.core.php
131
// Location: /core/EE_Response.core.php