Completed
Branch BETA-4.9-message-activity (66df31)
by
unknown
30:32 queued 12:39
created

EE_Response::deactivate_plugin()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
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
	 * @access 	protected
36
	 * @type 		bool
37
	 */
38
	protected $deactivate_plugin = false;
39
40
41
42
	/**
43
	 *    class constructor
44
	 *
45
	 * @access    public
46
	 * @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...
47
	 */
48
	public function __construct() {
49
		$this->terminate_request( false );
50
	}
51
52
53
54
	/**
55
	 *    set_notice
56
	 *
57
	 * @access    public
58
	 * @param $key
59
	 * @param $value
60
	 * @return    void
61
	 */
62
	public function set_notice( $key, $value ) {
63
		$this->_notice[ $key ] = $value;
64
	}
65
66
67
68
	/**
69
	 *    get_notice
70
	 *
71
	 * @access    public
72
	 * @param $key
73
	 * @return    mixed
74
	 */
75
	public function get_notice( $key ) {
76
		return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : NULL;
77
	}
78
79
80
81
	/**
82
	 *    get_notices
83
	 *
84
	 * @access    public
85
	 * @return    array
86
	 */
87
	public function get_notices() {
88
		return $this->_notice;
89
	}
90
91
92
93
	/**
94
	 *    add_output
95
	 *
96
	 * @access    public
97
	 * @param $string
98
	 * @param bool $append
99
	 */
100
	public function add_output( $string, $append = true ) {
101
		$this->_output = $append ? $this->_output . $string : $string . $this->_output;
102
	}
103
104
105
106
	/**
107
	 * 	get_output
108
	 *
109
	 *  @access 	public
110
	 *  @return 	string
111
	 */
112
	public function get_output() {
113
		return $this->_output;
114
	}
115
116
117
118
	/**
119
	 * @return boolean
120
	 */
121
	public function request_terminated() {
122
		return $this->request_terminated;
123
	}
124
125
126
127
	/**
128
	 * @param boolean $request_terminated
129
	 */
130
	public function terminate_request( $request_terminated = true ) {
131
		$this->request_terminated = filter_var( $request_terminated, FILTER_VALIDATE_BOOLEAN );
132
	}
133
134
135
136
	/**
137
	 * @return boolean
138
	 */
139
	public function plugin_deactivated() {
140
		return $this->deactivate_plugin;
141
	}
142
143
144
145
	/**
146
	 * sets $deactivate_plugin to true
147
	 */
148
	public function deactivate_plugin() {
149
		$this->deactivate_plugin = true;
150
	}
151
152
153
}
154
// End of file EE_Response.core.php
155
// Location: /core/EE_Response.core.php