Completed
Push — master ( 274f34...8ff377 )
by J.D.
04:05
created
src/includes/classes/hierarchy.php 2 patches
Doc Comments   +44 added lines patch added patch discarded remove patch
@@ -9,17 +9,49 @@  discard block
 block discarded – undo
9 9
 
10 10
 interface WordPoints_HierarchyI {
11 11
 	public function get();
12
+
13
+	/**
14
+	 * @return void
15
+	 */
12 16
 	public function push( $field, $data );
17
+
18
+	/**
19
+	 * @return void
20
+	 */
13 21
 	public function pop();
14 22
 	public function set_field( $field, $value );
23
+
24
+	/**
25
+	 * @param string $field
26
+	 * @param string $sub
27
+	 * @param string $sub_2
28
+	 */
15 29
 	public function get_field( $field, $sub = null, $sub_2 = null );
16 30
 	public function get_id();
17 31
 	public function go_to( $id );
32
+
33
+	/**
34
+	 * @param string $field
35
+	 *
36
+	 * @return void
37
+	 */
18 38
 	public function push_to( $field, $value );
39
+
40
+	/**
41
+	 * @return boolean
42
+	 */
19 43
 	public function ascend();
44
+
45
+	/**
46
+	 * @return boolean
47
+	 */
20 48
 	public function descend( $to = null );
21 49
 	public function is_main();
22 50
 	public function next();
51
+
52
+	/**
53
+	 * @return void
54
+	 */
23 55
 	public function reset();
24 56
 }
25 57
 
@@ -134,6 +166,9 @@  discard block
 block discarded – undo
134 166
 	protected $current = 0;
135 167
 	protected $i = 0;
136 168
 
169
+	/**
170
+	 * @param string $descendant_index
171
+	 */
137 172
 	public function __construct( $descendant_index ) {
138 173
 		$this->descendant_index = $descendant_index;
139 174
 	}
@@ -196,10 +231,16 @@  discard block
 block discarded – undo
196 231
 		$this->current = 0;
197 232
 	}
198 233
 
234
+	/**
235
+	 * @param string $field
236
+	 */
199 237
 	public function set_field( $field, $value ) {
200 238
 		$this->hierarchy[ $this->current ][ $field ] = $value;
201 239
 	}
202 240
 
241
+	/**
242
+	 * @param string $field
243
+	 */
203 244
 	public function get_field( $field, $sub = null, $sub_2 = null ) {
204 245
 
205 246
 		if ( ! isset( $this->hierarchy[ $this->current ][ $field ] ) ) {
@@ -225,6 +266,9 @@  discard block
 block discarded – undo
225 266
 		return $this->hierarchy[ $this->current ][ $field ];
226 267
 	}
227 268
 
269
+	/**
270
+	 * @param string $field
271
+	 */
228 272
 	public function push_to( $field, $value ) {
229 273
 
230 274
 		if ( ! isset( $this->hierarchy[ $this->current ][ $field ] ) ) {
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
 
10 10
 interface WordPoints_HierarchyI {
11 11
 	public function get();
12
-	public function push( $field, $data );
12
+	public function push($field, $data);
13 13
 	public function pop();
14
-	public function set_field( $field, $value );
15
-	public function get_field( $field, $sub = null, $sub_2 = null );
14
+	public function set_field($field, $value);
15
+	public function get_field($field, $sub = null, $sub_2 = null);
16 16
 	public function get_id();
17
-	public function go_to( $id );
18
-	public function push_to( $field, $value );
17
+	public function go_to($id);
18
+	public function push_to($field, $value);
19 19
 	public function ascend();
20
-	public function descend( $to = null );
20
+	public function descend($to = null);
21 21
 	public function is_main();
22 22
 	public function next();
23 23
 	public function reset();
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
 	protected $descendant_index;
32 32
 
33 33
 	public function __construct() {
34
-		$this->current =& $this->hierarchy;
34
+		$this->current = & $this->hierarchy;
35 35
 	}
36 36
 
37 37
 	public function get() {
38 38
 		return $this->hierarchy;
39 39
 	}
40 40
 
41
-	public function push( $field, $data ) {
41
+	public function push($field, $data) {
42 42
 
43
-		if ( ! isset( $this->current['slug'] ) || $this->current['slug'] !== $field ) {
43
+		if ( ! isset($this->current['slug']) || $this->current['slug'] !== $field) {
44 44
 
45
-			if ( ! empty( $this->hierarchy ) ) {
46
-				$this->current[ $this->descendant_index ][ $field ] = $data;
47
-				$this->current =& $this->current[ $this->descendant_index ][ $field ];
45
+			if ( ! empty($this->hierarchy)) {
46
+				$this->current[$this->descendant_index][$field] = $data;
47
+				$this->current = & $this->current[$this->descendant_index][$field];
48 48
 			} else {
49 49
 				$this->current = $this->stack[0] = $data;
50 50
 			}
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public function pop() {
59 59
 
60
-		unset( $this->current );
60
+		unset($this->current);
61 61
 
62
-		$this->current = array_pop( $this->stack );
62
+		$this->current = array_pop($this->stack);
63 63
 	}
64 64
 
65 65
 	public function reset() {
66 66
 		//	unset( $this->current_arg );
67
-		$this->current =& $this->hierarchy;
67
+		$this->current = & $this->hierarchy;
68 68
 		$this->stack = array();
69 69
 	}
70 70
 
@@ -80,30 +80,30 @@  discard block
 block discarded – undo
80 80
 //		return $this->current[ $field ];
81 81
 //	}
82 82
 
83
-	public function push_to( $field, $value ) {
83
+	public function push_to($field, $value) {
84 84
 
85
-		if ( ! isset( $this->current[ $field ] ) ) {
85
+		if ( ! isset($this->current[$field])) {
86 86
 
87 87
 		}
88 88
 		//var_dump( $field, $value,$this->current[ $field ] );
89
-		$this->current[ $field ][] = $value;
89
+		$this->current[$field][] = $value;
90 90
 	}
91 91
 
92
-	public function set_sub_field( $slug, $field, $value ) {
93
-		$this->current[ $this->descendant_index ][ $slug ][ $field ] = $value;
92
+	public function set_sub_field($slug, $field, $value) {
93
+		$this->current[$this->descendant_index][$slug][$field] = $value;
94 94
 	}
95 95
 
96
-	public function get_sub_field( $slug, $field ) {
97
-		return $this->current[ $this->descendant_index ][ $slug ][ $field ];
96
+	public function get_sub_field($slug, $field) {
97
+		return $this->current[$this->descendant_index][$slug][$field];
98 98
 	}
99 99
 
100
-	public function get_sub_data( $slug ) {
101
-		return $this->current[ $this->descendant_index ][ $slug ];
100
+	public function get_sub_data($slug) {
101
+		return $this->current[$this->descendant_index][$slug];
102 102
 	}
103 103
 
104 104
 	public function ascend() {
105 105
 
106
-		if ( ! $this->stack ) {
106
+		if ( ! $this->stack) {
107 107
 			return false;
108 108
 		}
109 109
 
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
 		return true;
113 113
 	}
114 114
 
115
-	public function descend( $to = null ) {
115
+	public function descend($to = null) {
116 116
 
117
-		if ( ! isset( $this->hierarchy[ $this->descendant_index ] ) ) {
117
+		if ( ! isset($this->hierarchy[$this->descendant_index])) {
118 118
 			return false;
119 119
 		}
120 120
 
121
-		reset( $this->current[ $this->descendant_index ] );
122
-		$field = key( $this->current[ $this->descendant_index ] );
123
-		$this->current =& $this->current[ $this->descendant_index ][ $field ];
121
+		reset($this->current[$this->descendant_index]);
122
+		$field = key($this->current[$this->descendant_index]);
123
+		$this->current = & $this->current[$this->descendant_index][$field];
124 124
 
125 125
 		$this->stack[] = $this->current;
126 126
 
@@ -134,52 +134,52 @@  discard block
 block discarded – undo
134 134
 	protected $current = 0;
135 135
 	protected $i = 0;
136 136
 
137
-	public function __construct( $descendant_index ) {
137
+	public function __construct($descendant_index) {
138 138
 		$this->descendant_index = $descendant_index;
139 139
 	}
140 140
 
141 141
 	public function get() {
142 142
 	//	var_dump( $this->hierarchy );
143 143
 
144
-		if ( empty( $this->hierarchy ) ) {
144
+		if (empty($this->hierarchy)) {
145 145
 			return array();
146 146
 		}
147 147
 
148
-		return $this->build_hierarchy( $this->hierarchy[0] );
148
+		return $this->build_hierarchy($this->hierarchy[0]);
149 149
 	}
150 150
 
151
-	protected function build_hierarchy( $arg ) {
151
+	protected function build_hierarchy($arg) {
152 152
 
153
-		if ( isset( $arg[ $this->descendant_index ] ) ) {
153
+		if (isset($arg[$this->descendant_index])) {
154 154
 
155
-			foreach ( $arg[ $this->descendant_index ] as $sub_arg => $i ) {
156
-				$arg[ $this->descendant_index ][ $sub_arg ] = $this->build_hierarchy( $this->hierarchy[ $i ] );
155
+			foreach ($arg[$this->descendant_index] as $sub_arg => $i) {
156
+				$arg[$this->descendant_index][$sub_arg] = $this->build_hierarchy($this->hierarchy[$i]);
157 157
 			}
158 158
 		}
159 159
 
160
-		if ( isset( $arg['_parent'] ) ) {
161
-			unset( $arg['_parent'] );
160
+		if (isset($arg['_parent'])) {
161
+			unset($arg['_parent']);
162 162
 		}
163 163
 
164
-		unset( $arg['_i'] );
164
+		unset($arg['_i']);
165 165
 
166 166
 		return $arg;
167 167
 	}
168 168
 
169
-	public function push( $field, $data ) {
169
+	public function push($field, $data) {
170 170
 
171
-		if ( ! isset( $this->hierarchy[ $this->current ]['slug'] ) || $this->hierarchy[ $this->current ]['slug'] !== $field ) {
171
+		if ( ! isset($this->hierarchy[$this->current]['slug']) || $this->hierarchy[$this->current]['slug'] !== $field) {
172 172
 
173 173
 			$i = $this->i++;
174 174
 
175
-			if ( ! empty( $this->hierarchy ) ) {
176
-				$this->hierarchy[ $this->current ][ $this->descendant_index ][ $field ] = $i;
175
+			if ( ! empty($this->hierarchy)) {
176
+				$this->hierarchy[$this->current][$this->descendant_index][$field] = $i;
177 177
 				$data['_parent'] = $this->current;
178 178
 			}
179 179
 
180
-			$this->hierarchy[ $i ] = $data;
181
-			$this->hierarchy[ $i ]['slug'] = $field;
182
-			$this->hierarchy[ $i ]['_i'] = $i;
180
+			$this->hierarchy[$i] = $data;
181
+			$this->hierarchy[$i]['slug'] = $field;
182
+			$this->hierarchy[$i]['_i'] = $i;
183 183
 
184 184
 			$this->current = $i;
185 185
 		}
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 
188 188
 	public function pop() {
189 189
 
190
-		$this->current = isset( $this->hierarchy[ $this->current ]['_parent'] )
191
-			?  $this->hierarchy[ $this->current ]['_parent']
190
+		$this->current = isset($this->hierarchy[$this->current]['_parent'])
191
+			? $this->hierarchy[$this->current]['_parent']
192 192
 			: 0;
193 193
 	}
194 194
 
@@ -196,95 +196,95 @@  discard block
 block discarded – undo
196 196
 		$this->current = 0;
197 197
 	}
198 198
 
199
-	public function set_field( $field, $value ) {
200
-		$this->hierarchy[ $this->current ][ $field ] = $value;
199
+	public function set_field($field, $value) {
200
+		$this->hierarchy[$this->current][$field] = $value;
201 201
 	}
202 202
 
203
-	public function get_field( $field, $sub = null, $sub_2 = null ) {
203
+	public function get_field($field, $sub = null, $sub_2 = null) {
204 204
 
205
-		if ( ! isset( $this->hierarchy[ $this->current ][ $field ] ) ) {
205
+		if ( ! isset($this->hierarchy[$this->current][$field])) {
206 206
 			return null;
207 207
 		}
208 208
 
209
-		if ( isset( $sub ) ) {
210
-			if ( ! isset( $this->hierarchy[ $this->current ][ $field ][ $sub ] ) ) {
209
+		if (isset($sub)) {
210
+			if ( ! isset($this->hierarchy[$this->current][$field][$sub])) {
211 211
 				return null;
212 212
 			}
213 213
 
214
-			if ( isset( $sub_2 ) ) {
215
-				if ( ! isset( $this->hierarchy[ $this->current ][ $field ][ $sub ][ $sub_2 ] ) ) {
214
+			if (isset($sub_2)) {
215
+				if ( ! isset($this->hierarchy[$this->current][$field][$sub][$sub_2])) {
216 216
 					return null;
217 217
 				} else {
218
-					return $this->hierarchy[ $this->current ][ $field ][ $sub ][ $sub_2 ];
218
+					return $this->hierarchy[$this->current][$field][$sub][$sub_2];
219 219
 				}
220 220
 			}
221 221
 
222
-			return $this->hierarchy[ $this->current ][ $field ][ $sub ];
222
+			return $this->hierarchy[$this->current][$field][$sub];
223 223
 		}
224 224
 
225
-		return $this->hierarchy[ $this->current ][ $field ];
225
+		return $this->hierarchy[$this->current][$field];
226 226
 	}
227 227
 
228
-	public function push_to( $field, $value ) {
228
+	public function push_to($field, $value) {
229 229
 
230
-		if ( ! isset( $this->hierarchy[ $this->current ][ $field ] ) ) {
230
+		if ( ! isset($this->hierarchy[$this->current][$field])) {
231 231
 
232 232
 		}
233 233
 		//var_dump( $field, $value,$this->current[ $field ] );
234
-		$this->hierarchy[ $this->current ][ $field ][] = $value;
234
+		$this->hierarchy[$this->current][$field][] = $value;
235 235
 	}
236 236
 
237
-	public function set_sub_field( $slug, $field, $value ) {
238
-		$this->hierarchy[ $this->current ][ $this->descendant_index ][ $slug ][ $field ] = $value;
237
+	public function set_sub_field($slug, $field, $value) {
238
+		$this->hierarchy[$this->current][$this->descendant_index][$slug][$field] = $value;
239 239
 	}
240 240
 
241
-	public function get_sub_field( $slug, $field ) {
241
+	public function get_sub_field($slug, $field) {
242 242
 
243
-		return $this->hierarchy[ $this->current ][ $this->descendant_index ][ $slug ][ $field ];
243
+		return $this->hierarchy[$this->current][$this->descendant_index][$slug][$field];
244 244
 	}
245 245
 
246
-	public function get_sub_data( $slug ) {
247
-		return $this->hierarchy[ $this->current ][ $this->descendant_index ][ $slug ];
246
+	public function get_sub_data($slug) {
247
+		return $this->hierarchy[$this->current][$this->descendant_index][$slug];
248 248
 	}
249 249
 
250
-	public function has_child( $slug ) {
251
-		return isset( $this->hierarchy[ $this->current ][ $this->descendant_index ][ $slug ] );
250
+	public function has_child($slug) {
251
+		return isset($this->hierarchy[$this->current][$this->descendant_index][$slug]);
252 252
 	}
253 253
 
254 254
 	public function get_children() {
255
-		return isset( $this->hierarchy[ $this->current ][ $this->descendant_index ][ $slug ] );
255
+		return isset($this->hierarchy[$this->current][$this->descendant_index][$slug]);
256 256
 
257 257
 	}
258 258
 
259 259
 	public function ascend() {
260 260
 
261
-		if ( ! isset( $this->hierarchy[ $this->current ]['_parent'] ) ) {
261
+		if ( ! isset($this->hierarchy[$this->current]['_parent'])) {
262 262
 			return false;
263 263
 		}
264 264
 
265
-		$this->current = $this->hierarchy[ $this->current ]['_parent'];
265
+		$this->current = $this->hierarchy[$this->current]['_parent'];
266 266
 
267 267
 		return true;
268 268
 	}
269 269
 
270
-	public function descend( $to = null ) {
270
+	public function descend($to = null) {
271 271
 
272
-		if ( ! isset( $this->hierarchy[ $this->current ][ $this->descendant_index ] ) ) {
272
+		if ( ! isset($this->hierarchy[$this->current][$this->descendant_index])) {
273 273
 			return false;
274 274
 		}
275 275
 
276
-		if ( isset( $to ) ) {
276
+		if (isset($to)) {
277 277
 
278
-			if ( ! isset( $this->hierarchy[ $this->current ][ $this->descendant_index ][ $to ] ) ) {
278
+			if ( ! isset($this->hierarchy[$this->current][$this->descendant_index][$to])) {
279 279
 				return false;
280 280
 			}
281 281
 
282
-			$this->current = $this->hierarchy[ $this->current ][ $this->descendant_index ][ $to ];
282
+			$this->current = $this->hierarchy[$this->current][$this->descendant_index][$to];
283 283
 
284 284
 		} else {
285 285
 
286 286
 			$this->current = reset(
287
-				$this->hierarchy[ $this->current ][ $this->descendant_index ]
287
+				$this->hierarchy[$this->current][$this->descendant_index]
288 288
 			);
289 289
 		}
290 290
 
@@ -293,29 +293,29 @@  discard block
 block discarded – undo
293 293
 
294 294
 	public function next() {
295 295
 
296
-		if ( ! isset( $this->hierarchy[ $this->current ]['_parent'] ) ) {
296
+		if ( ! isset($this->hierarchy[$this->current]['_parent'])) {
297 297
 			return false;
298 298
 		}
299 299
 
300
-		$parent = $this->hierarchy[ $this->current ]['_parent'];
300
+		$parent = $this->hierarchy[$this->current]['_parent'];
301 301
 
302
-		if ( ! isset( $this->hierarchy[ $parent ][ $this->descendant_index ] ) ) {
302
+		if ( ! isset($this->hierarchy[$parent][$this->descendant_index])) {
303 303
 			return false;
304 304
 		}
305 305
 
306
-		$sub_args = $this->hierarchy[ $parent ][ $this->descendant_index ];
306
+		$sub_args = $this->hierarchy[$parent][$this->descendant_index];
307 307
 
308
-		reset( $sub_args );
308
+		reset($sub_args);
309 309
 
310
-		while ( current( $sub_args ) !== $this->current ) {
311
-			next( $sub_args );
310
+		while (current($sub_args) !== $this->current) {
311
+			next($sub_args);
312 312
 		}
313 313
 
314
-		if ( ! next( $sub_args ) ) {
314
+		if ( ! next($sub_args)) {
315 315
 			return false;
316 316
 		}
317 317
 
318
-		$this->current = current( $sub_args );
318
+		$this->current = current($sub_args);
319 319
 
320 320
 		return true;
321 321
 	}
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
 		return $this->current;
325 325
 	}
326 326
 
327
-	public function go_to( $id ) {
327
+	public function go_to($id) {
328 328
 
329
-		if ( false === wordpoints_posint( $id ) || $id < 0 ) {
329
+		if (false === wordpoints_posint($id) || $id < 0) {
330 330
 			return;
331 331
 		}
332 332
 
Please login to merge, or discard this patch.
src/includes/classes/hook/retroactive/query.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -73,6 +73,10 @@
 block discarded – undo
73 73
 
74 74
 
75 75
 interface WordPoints_Hook_Reactor_RetroactiveI extends WordPoints_Hook_Retroactive_Query_ModifierI {
76
+
77
+	/**
78
+	 * @return void
79
+	 */
76 80
 	public function retroactive_hit( $target, array $records, WordPoints_Hook_Event_RetroactiveI $event, WordPoints_Hook_ReactionI $reaction );
77 81
 }
78 82
 
Please login to merge, or discard this patch.
Spacing   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 
74 74
 
75 75
 interface WordPoints_Hook_Reactor_RetroactiveI extends WordPoints_Hook_Retroactive_Query_ModifierI {
76
-	public function retroactive_hit( $target, array $records, WordPoints_Hook_Event_RetroactiveI $event, WordPoints_Hook_ReactionI $reaction );
76
+	public function retroactive_hit($target, array $records, WordPoints_Hook_Event_RetroactiveI $event, WordPoints_Hook_ReactionI $reaction);
77 77
 }
78 78
 
79 79
 abstract class WordPoints_Hook_Reactor_Retroactive implements WordPoints_Hook_Reactor_RetroactiveI {
80 80
 
81
-	public function modify_retroactive_query( WordPoints_Hook_Retroactive_QueryI $query ) {
81
+	public function modify_retroactive_query(WordPoints_Hook_Retroactive_QueryI $query) {
82 82
 
83
-		$query->set_target( $query->get_reaction()->get_meta( 'target' ) );
83
+		$query->set_target($query->get_reaction()->get_meta('target'));
84 84
 	}
85 85
 
86 86
 	public function reverse_hits() {
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
 	/**
98 98
 	 * @since 1.0.0
99 99
 	 */
100
-	public function retroactive_hit( $target, array $records, WordPoints_Hook_Event_RetroactiveI $event, WordPoints_Hook_ReactionI $reaction ) {
100
+	public function retroactive_hit($target, array $records, WordPoints_Hook_Event_RetroactiveI $event, WordPoints_Hook_ReactionI $reaction) {
101 101
 
102
-		$count = count( $records );
102
+		$count = count($records);
103 103
 
104 104
 		wordpoints_alter_points(
105 105
 			$target
106
-			, $reaction->get_meta( 'points' ) * $count
107
-			, $reaction->get_meta( 'points_type' )
108
-			, 'retroactive_' . $reaction->get_event_slug()
109
-			, array( 'count' => $count )
110
-			, $event->get_retroactive_description( $reaction )
106
+			, $reaction->get_meta('points') * $count
107
+			, $reaction->get_meta('points_type')
108
+			, 'retroactive_'.$reaction->get_event_slug()
109
+			, array('count' => $count)
110
+			, $event->get_retroactive_description($reaction)
111 111
 		);
112 112
 	}
113 113
 
@@ -139,22 +139,22 @@  discard block
 block discarded – undo
139 139
 
140 140
 		$logs = $query->get();
141 141
 
142
-		if ( ! $logs ) {
142
+		if ( ! $logs) {
143 143
 			return;
144 144
 		}
145 145
 
146
-		foreach ( $logs as $log ) {
146
+		foreach ($logs as $log) {
147 147
 
148 148
 			wordpoints_alter_points(
149 149
 				$log->user_id
150
-				, - ( $log->points / wordpoints_get_points_log_meta( $log->id, 'count', true ) )
150
+				, -($log->points / wordpoints_get_points_log_meta($log->id, 'count', true))
151 151
 				, $log->points_type
152 152
 				, "reverse_{$event}"
153
-				, array( 'original_log_id' => $log->id )
153
+				, array('original_log_id' => $log->id)
154 154
 				, $args->get_description()
155 155
 			);
156 156
 
157
-			wordpoints_add_points_log_meta( $log->id, 'auto_reversed', $args->get_entity_id() );
157
+			wordpoints_add_points_log_meta($log->id, 'auto_reversed', $args->get_entity_id());
158 158
 		}
159 159
 	}
160 160
 }
@@ -196,13 +196,13 @@  discard block
 block discarded – undo
196 196
 
197 197
 	protected $results;
198 198
 
199
-	public function __construct( WordPoints_Hook_ReactionI $reaction ) {
199
+	public function __construct(WordPoints_Hook_ReactionI $reaction) {
200 200
 
201 201
 		$this->reaction = $reaction;
202
-		$this->arg_hierarchy = new WordPoints_Hierarchy( 'sub_args' );
202
+		$this->arg_hierarchy = new WordPoints_Hierarchy('sub_args');
203 203
 		$this->hooks = wordpoints_hooks();
204 204
 		$this->entities = wordpoints_entities();
205
-		$this->validator = new WordPoints_Hook_Reaction_Validator( $reaction, true );
205
+		$this->validator = new WordPoints_Hook_Reaction_Validator($reaction, true);
206 206
 	}
207 207
 
208 208
 	public function get_reaction() {
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
 
216 216
 	public function get_results() {
217 217
 
218
-		if ( ! isset( $this->results ) ) {
218
+		if ( ! isset($this->results)) {
219 219
 
220 220
 			$this->execute();
221 221
 
222
-			if ( $this->validator->had_errors() ) {
222
+			if ($this->validator->had_errors()) {
223 223
 				$this->results = $this->validator;
224 224
 			}
225 225
 		}
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 			$this->filter_results();
237 237
 			$this->group_results();
238 238
 
239
-		} catch ( WordPoints_Hook_Validator_Exception $e ) {
240
-			unset( $e );
239
+		} catch (WordPoints_Hook_Validator_Exception $e) {
240
+			unset($e);
241 241
 		}
242 242
 	}
243 243
 
@@ -245,32 +245,32 @@  discard block
 block discarded – undo
245 245
 
246 246
 		$event_slug = $this->reaction->get_event_slug();
247 247
 
248
-		$event = $this->hooks->events->get( $event_slug );
248
+		$event = $this->hooks->events->get($event_slug);
249 249
 
250
-		if ( ! ( $event instanceof WordPoints_Hook_Event_RetroactiveI ) ) {
251
-			$this->validator->add_error( 'invalid hook' );
250
+		if ( ! ($event instanceof WordPoints_Hook_Event_RetroactiveI)) {
251
+			$this->validator->add_error('invalid hook');
252 252
 		}
253 253
 
254
-		foreach ( $this->hooks->events->args->get_children( $event_slug ) as $arg ) {
254
+		foreach ($this->hooks->events->args->get_children($event_slug) as $arg) {
255 255
 			$this->arg_hierarchy_push( // TODO
256 256
 				$arg
257 257
 			);
258 258
 		}
259 259
 
260
-		if ( $event instanceof WordPoints_Hook_Retroactive_Query_ModifierI ) {
261
-			$event->modify_retroactive_query( $this );
260
+		if ($event instanceof WordPoints_Hook_Retroactive_Query_ModifierI) {
261
+			$event->modify_retroactive_query($this);
262 262
 			$this->reset();
263 263
 		}
264 264
 
265
-		$reactor = $this->hooks->reactors->get( $this->reaction->get_reactor_slug() );
265
+		$reactor = $this->hooks->reactors->get($this->reaction->get_reactor_slug());
266 266
 
267
-		$reactor->modify_retroactive_query( $this );
267
+		$reactor->modify_retroactive_query($this);
268 268
 		$this->reset();
269 269
 
270
-		foreach ( $this->hooks->extensions->get_all() as $extension ) {
270
+		foreach ($this->hooks->extensions->get_all() as $extension) {
271 271
 
272
-			if ( $extension instanceof WordPoints_Hook_Retroactive_Query_ModifierI ) {
273
-				$extension->modify_retroactive_query( $this );
272
+			if ($extension instanceof WordPoints_Hook_Retroactive_Query_ModifierI) {
273
+				$extension->modify_retroactive_query($this);
274 274
 				$this->reset();
275 275
 			}
276 276
 		}
@@ -278,126 +278,126 @@  discard block
 block discarded – undo
278 278
 
279 279
 	protected function perform_query() {
280 280
 
281
-		$this->queries = new WordPoints_Hierarchy( 'sub_queries' );
282
-		$this->consolidate_queries( array( $this->arg_hierarchy->get() ) );
283
-		unset( $this->query );
281
+		$this->queries = new WordPoints_Hierarchy('sub_queries');
282
+		$this->consolidate_queries(array($this->arg_hierarchy->get()));
283
+		unset($this->query);
284 284
 
285 285
 		$this->queries->reset();
286 286
 
287 287
 		// Find the tip of a query.
288
-		$this->results = $this->execute_queries( $this->queries->get() );
288
+		$this->results = $this->execute_queries($this->queries->get());
289 289
 
290
-		if ( is_wp_error( $this->results ) ) {
291
-			$this->validator->add_error( $this->results );
290
+		if (is_wp_error($this->results)) {
291
+			$this->validator->add_error($this->results);
292 292
 		}
293 293
 	}
294 294
 
295
-	protected function consolidate_queries( $arg_hierarchy, $storage_type = null ) {
295
+	protected function consolidate_queries($arg_hierarchy, $storage_type = null) {
296 296
 
297
-		foreach ( $arg_hierarchy as $data ) {
298
-			$this->consolidate_query( $data );
297
+		foreach ($arg_hierarchy as $data) {
298
+			$this->consolidate_query($data);
299 299
 		}
300 300
 	}
301 301
 
302
-	protected function consolidate_query( $data ) {
302
+	protected function consolidate_query($data) {
303 303
 
304
-		if ( $data['storage_info']['type'] !== $this->queries->get_field( 'slug' ) ) {
304
+		if ($data['storage_info']['type'] !== $this->queries->get_field('slug')) {
305 305
 
306 306
 			$parent_id = null;
307
-			if ( isset( $this->query ) ) {
307
+			if (isset($this->query)) {
308 308
 				$parent_id = $this->query->get_id();
309 309
 			}
310 310
 
311
-			$this->query = new WordPoints_Hierarchy( 'sub_args' );
311
+			$this->query = new WordPoints_Hierarchy('sub_args');
312 312
 
313 313
 			$this->queries->push(
314 314
 				$data['storage_info']['type']
315
-				, array( 'query' => $this->query, 'parent_id' => $parent_id )
315
+				, array('query' => $this->query, 'parent_id' => $parent_id)
316 316
 			);
317 317
 
318 318
 			$pushed_query = true;
319 319
 		}
320 320
 
321
-		if ( isset( $data['sub_args'] ) ) {
321
+		if (isset($data['sub_args'])) {
322 322
 			$sub_args = $data['sub_args'];
323
-			unset( $data['sub_args'] );
323
+			unset($data['sub_args']);
324 324
 		}
325 325
 
326
-		$this->query->push( $data['slug'], $data );
326
+		$this->query->push($data['slug'], $data);
327 327
 
328
-		if ( isset( $sub_args ) ) {
329
-			$this->consolidate_queries( $sub_args, $data['storage_info']['type'] );
328
+		if (isset($sub_args)) {
329
+			$this->consolidate_queries($sub_args, $data['storage_info']['type']);
330 330
 		}
331 331
 
332 332
 		$this->query->pop();
333 333
 
334
-		if ( ! empty( $pushed_query ) ) {
334
+		if ( ! empty($pushed_query)) {
335 335
 			$this->queries->pop();
336
-			$this->query = $this->queries->get_field( 'query' );
336
+			$this->query = $this->queries->get_field('query');
337 337
 		}
338 338
 	}
339 339
 
340
-	protected function execute_queries( $queries ) {
340
+	protected function execute_queries($queries) {
341 341
 
342 342
 		/** @var WordPoints_HierarchyI $query */
343 343
 		$query = $queries['query'];
344 344
 
345
-		if ( isset( $queries['sub_queries'] ) ) {
346
-			foreach ( $queries['sub_queries'] as $query_data ) {
345
+		if (isset($queries['sub_queries'])) {
346
+			foreach ($queries['sub_queries'] as $query_data) {
347 347
 
348
-				$results = $this->execute_queries( $query_data );
348
+				$results = $this->execute_queries($query_data);
349 349
 
350
-				if ( is_wp_error( $results ) ) {
350
+				if (is_wp_error($results)) {
351 351
 					return $results;
352 352
 				}
353 353
 
354
-				if ( empty( $results ) ) {
354
+				if (empty($results)) {
355 355
 					return array();
356 356
 				}
357 357
 
358 358
 				/** @var WordPoints_HierarchyI $child_query */
359 359
 				$child_query = $query_data['query'];
360
-				$query->go_to( $query_data['parent_id'] );
360
+				$query->go_to($query_data['parent_id']);
361 361
 
362 362
 				$condition = array(
363 363
 //					'field' => $child_query->get_field( 'slug' ),
364 364
 					'compare' => 'in',
365 365
 					'value' => wp_list_pluck(
366 366
 						$results
367
-						, $child_query->get_field( 'storage_info', 'meta', 'id_field' )
367
+						, $child_query->get_field('storage_info', 'meta', 'id_field')
368 368
 					),
369 369
 				);
370 370
 
371
-				$query->push_to( 'conditions', $condition );
371
+				$query->push_to('conditions', $condition);
372 372
 			}
373 373
 		}
374 374
 
375 375
 		$query->reset();
376
-		$storage_type = $query->get_field( 'storage_info', 'type' );
376
+		$storage_type = $query->get_field('storage_info', 'type');
377 377
 
378 378
 		// it is pretty stupid to wait until now to figure this out.
379
-		$executor = $this->hooks->retroactive_query_executors->get( $storage_type );
379
+		$executor = $this->hooks->retroactive_query_executors->get($storage_type);
380 380
 
381
-		if ( ! $executor ) {
381
+		if ( ! $executor) {
382 382
 			$this->validator->add_error(
383
-				sprintf( 'unknown storage type "%s".', $storage_type )
383
+				sprintf('unknown storage type "%s".', $storage_type)
384 384
 			);
385 385
 		}
386 386
 
387
-		return $executor->execute( array( $query->get() ) );
387
+		return $executor->execute(array($query->get()));
388 388
 	}
389 389
 
390 390
 	protected function filter_results() {
391 391
 
392
-		$reactor = $this->hooks->reactors->get( $this->reaction->get_reactor_slug() );
392
+		$reactor = $this->hooks->reactors->get($this->reaction->get_reactor_slug());
393 393
 
394
-		if ( $reactor instanceof WordPoints_Hook_Retroactive_Query_FilterI ) {
395
-			$reactor->filter_retroactive_query( $this );
394
+		if ($reactor instanceof WordPoints_Hook_Retroactive_Query_FilterI) {
395
+			$reactor->filter_retroactive_query($this);
396 396
 		}
397 397
 
398
-		foreach ( $this->hooks->extensions->get_all() as $extension ) {
399
-			if ( $extension instanceof WordPoints_Hook_Retroactive_Query_FilterI ) {
400
-				$extension->filter_retroactive_query( $this );
398
+		foreach ($this->hooks->extensions->get_all() as $extension) {
399
+			if ($extension instanceof WordPoints_Hook_Retroactive_Query_FilterI) {
400
+				$extension->filter_retroactive_query($this);
401 401
 			}
402 402
 		}
403 403
 	}
@@ -406,27 +406,27 @@  discard block
 block discarded – undo
406 406
 
407 407
 		$grouped_results = array();
408 408
 
409
-		foreach ( $this->results as $result ) {
410
-			$grouped_results[ $result->target ][] = $result;
409
+		foreach ($this->results as $result) {
410
+			$grouped_results[$result->target][] = $result;
411 411
 		}
412 412
 
413 413
 		$this->results = $grouped_results;
414 414
 	}
415 415
 
416
-	public function add_condition( array $condition ) {
416
+	public function add_condition(array $condition) {
417 417
 
418
-		$this->arg_hierarchy->push_to( 'conditions', $condition );
418
+		$this->arg_hierarchy->push_to('conditions', $condition);
419 419
 	}
420 420
 
421
-	public function select_value( $data = array() ) {
421
+	public function select_value($data = array()) {
422 422
 
423
-		$this->arg_hierarchy->set_field( 'select', $data );
423
+		$this->arg_hierarchy->set_field('select', $data);
424 424
 	}
425 425
 
426
-	public function set_target( $target_arg ) {
426
+	public function set_target($target_arg) {
427 427
 
428
-		foreach ( $target_arg as $arg_slug ) {
429
-			$this->arg_hierarchy_push( $arg_slug );
428
+		foreach ($target_arg as $arg_slug) {
429
+			$this->arg_hierarchy_push($arg_slug);
430 430
 		}
431 431
 
432 432
 //		$id = $this->arg_hierarchy->get_id();
@@ -436,10 +436,10 @@  discard block
 block discarded – undo
436 436
 //			$field = $this->arg_hierarchy->get_field( 'storage_info', 'meta', 'field' );
437 437
 //			$this->arg_hierarchy->ascend();
438 438
 //		} else {
439
-			$field = $this->arg_hierarchy->get_field( 'storage_info', 'meta', 'id_field' );
439
+			$field = $this->arg_hierarchy->get_field('storage_info', 'meta', 'id_field');
440 440
 //		}
441 441
 
442
-		$this->select_value( array( 'field' => $field, 'as' => 'target' ) );
442
+		$this->select_value(array('field' => $field, 'as' => 'target'));
443 443
 
444 444
 //		$this->arg_hierarchy->go_to( $id );
445 445
 	}
@@ -451,40 +451,40 @@  discard block
 block discarded – undo
451 451
 	 * @return WordPoints_EntityishI
452 452
 	 */
453 453
 	public function get_arg() {
454
-		return $this->arg_hierarchy->get_field( 'arg' );
454
+		return $this->arg_hierarchy->get_field('arg');
455 455
 	}
456 456
 
457
-	public function arg_hierarchy_push( $slug ) {
457
+	public function arg_hierarchy_push($slug) {
458 458
 
459
-		$current_slug = $this->arg_hierarchy->get_field( 'slug' );
459
+		$current_slug = $this->arg_hierarchy->get_field('slug');
460 460
 
461
-		if ( $current_slug === $slug && $this->arg_hierarchy->is_main() ) {
461
+		if ($current_slug === $slug && $this->arg_hierarchy->is_main()) {
462 462
 			return;
463 463
 		}
464 464
 
465 465
 //		if ( $current_slug !== $slug ) {
466 466
 
467
-			if ( empty( $current_slug ) ) {
468
-				$arg = $this->entities->get( $slug );
467
+			if (empty($current_slug)) {
468
+				$arg = $this->entities->get($slug);
469 469
 			} else {
470 470
 
471 471
 				// If this child exists, don't overwrite it, just descend into it.
472
-				if ( $this->arg_hierarchy->has_child( $slug ) ) {
473
-					$this->arg_hierarchy->descend( $slug );
472
+				if ($this->arg_hierarchy->has_child($slug)) {
473
+					$this->arg_hierarchy->descend($slug);
474 474
 					return;
475 475
 				}
476 476
 
477
-				$parent_arg = $this->arg_hierarchy->get_field( 'arg' );
477
+				$parent_arg = $this->arg_hierarchy->get_field('arg');
478 478
 
479
-				if ( $parent_arg instanceof WordPoints_Entity_ParentI ) {
480
-					$arg = $parent_arg->get_child( $slug );
479
+				if ($parent_arg instanceof WordPoints_Entity_ParentI) {
480
+					$arg = $parent_arg->get_child($slug);
481 481
 				} else {
482 482
 					return; // TODO
483 483
 				}
484 484
 			}
485 485
 
486
-			if ( $arg instanceof WordPoints_Entity_Array ) {
487
-				$arg = $this->entities->get( $arg->get_entity_slug() );
486
+			if ($arg instanceof WordPoints_Entity_Array) {
487
+				$arg = $this->entities->get($arg->get_entity_slug());
488 488
 			}
489 489
 
490 490
 			$data['arg'] = $arg;
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 			// TODO check if storage type is recognized?
493 493
 			$data['storage_info'] = $arg->get_storage_info();
494 494
 
495
-			$this->arg_hierarchy->push( $slug, $data );
495
+			$this->arg_hierarchy->push($slug, $data);
496 496
 
497 497
 //		} else {
498 498
 //			$data = array();
@@ -509,11 +509,11 @@  discard block
 block discarded – undo
509 509
 }
510 510
 
511 511
 interface WordPoints_Hook_Retroactive_Query_FilterI {
512
-	public function filter_retroactive_query( WordPoints_Hook_Retroactive_QueryI $query );
512
+	public function filter_retroactive_query(WordPoints_Hook_Retroactive_QueryI $query);
513 513
 }
514 514
 
515 515
 interface WordPoints_Hook_Retroactive_Query_ExecutorI {
516
-	public function execute( $query );
516
+	public function execute($query);
517 517
 }
518 518
 
519 519
 /*
@@ -542,48 +542,48 @@  discard block
 block discarded – undo
542 542
 	protected $array;
543 543
 	protected $results;
544 544
 
545
-	public function execute( $query ) {
545
+	public function execute($query) {
546 546
 
547
-		foreach ( $query as $arg_data ) {
547
+		foreach ($query as $arg_data) {
548 548
 
549 549
 			$meta = $arg_data['storage_info']['meta'];
550 550
 
551
-			if ( isset( $meta['getter'] ) ) {
551
+			if (isset($meta['getter'])) {
552 552
 				$this->array = $meta['getter']();
553 553
 			}
554 554
 
555
-			if ( isset( $arg_data['conditions'] ) ) {
555
+			if (isset($arg_data['conditions'])) {
556 556
 
557
-				foreach ( $arg_data['conditions'] as $condition ) {
557
+				foreach ($arg_data['conditions'] as $condition) {
558 558
 
559
-					if ( ! isset( $condition['field'] ) ) {
560
-						if ( $arg_data['arg'] instanceof WordPoints_Entity_Attr ) {
559
+					if ( ! isset($condition['field'])) {
560
+						if ($arg_data['arg'] instanceof WordPoints_Entity_Attr) {
561 561
 							$condition['field'] = $meta['field'];
562 562
 						} else {
563 563
 							$condition['field'] = $meta['id_field'];
564 564
 						}
565 565
 					}
566 566
 
567
-					if ( ! isset( $condition['condition'] ) ) {
567
+					if ( ! isset($condition['condition'])) {
568 568
 						$condition['condition'] = '=';
569 569
 					}
570 570
 
571 571
 					$filter_args = array();
572 572
 
573
-					switch ( $condition['condition'] ) {
573
+					switch ($condition['condition']) {
574 574
 
575 575
 						case '=':
576
-							$filter_args[ $condition['field'] ] = $condition['value'];
576
+							$filter_args[$condition['field']] = $condition['value'];
577 577
 							break;
578 578
 
579 579
 						case 'in':
580 580
 							// TODO
581 581
 
582 582
 						default:
583
-							return new WP_Error( 'invalid condition type' );
583
+							return new WP_Error('invalid condition type');
584 584
 					}
585 585
 
586
-					$this->array = wp_list_filter( $this->array, $filter_args );
586
+					$this->array = wp_list_filter($this->array, $filter_args);
587 587
 				}
588 588
 			}
589 589
 
@@ -591,9 +591,9 @@  discard block
 block discarded – undo
591 591
 //				$builder->add_field( $arg_data['select'] );
592 592
 //			}
593 593
 
594
-			if ( isset( $arg_data['sub_args'] ) ) {
594
+			if (isset($arg_data['sub_args'])) {
595 595
 				$this->parent_data = $arg_data;
596
-				$this->array = $this->execute( $arg_data['sub_args'] );
596
+				$this->array = $this->execute($arg_data['sub_args']);
597 597
 			}
598 598
 
599 599
 			$this->results = $this->array;
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 
623 623
 	protected $entered_join;
624 624
 
625
-	public function execute( $query ) {
625
+	public function execute($query) {
626 626
 		// WE should be getting a hierarchy object here.
627 627
 		// This will let us loop over things easier.
628 628
 		// We'll also need to be marking the non-usable parts of the query.
@@ -632,69 +632,69 @@  discard block
 block discarded – undo
632 632
 
633 633
 		$this->builder = new WordPoints_Query_Builder_DB_MySQL();
634 634
 
635
-		$this->build_query( $query );
635
+		$this->build_query($query);
636 636
 
637 637
 		$sql = $this->builder->get_query();
638 638
 
639
-		if ( is_wp_error( $sql ) ) {
639
+		if (is_wp_error($sql)) {
640 640
 			return $sql;
641 641
 		}
642 642
 
643
-		return $wpdb->get_results( $sql );
643
+		return $wpdb->get_results($sql);
644 644
 	}
645 645
 
646
-	protected function build_query( $args ) {
646
+	protected function build_query($args) {
647 647
 
648
-		foreach ( $args as $arg_data ) {
648
+		foreach ($args as $arg_data) {
649 649
 
650 650
 			$this->arg_data = $arg_data;
651 651
 
652
-			if ( isset( $arg_data['storage_info']['meta']['table_name'] ) ) {
653
-				$this->build_table_schema( $arg_data['storage_info']['meta'] );
652
+			if (isset($arg_data['storage_info']['meta']['table_name'])) {
653
+				$this->build_table_schema($arg_data['storage_info']['meta']);
654 654
 			}
655 655
 
656
-			if ( isset( $arg_data['conditions'] ) ) {
657
-				$this->build_conditions( $arg_data['conditions'] );
656
+			if (isset($arg_data['conditions'])) {
657
+				$this->build_conditions($arg_data['conditions']);
658 658
 			}
659 659
 
660
-			if ( isset( $arg_data['select'] ) ) {
661
-				$this->builder->add_field( $arg_data['select'] );
660
+			if (isset($arg_data['select'])) {
661
+				$this->builder->add_field($arg_data['select']);
662 662
 			}
663 663
 
664
-			if ( isset( $arg_data['sub_args'] ) ) {
664
+			if (isset($arg_data['sub_args'])) {
665 665
 
666 666
 				$this->grandparent_data = $this->parent_data;
667 667
 				$this->parent_data = $arg_data;
668 668
 
669
-				$this->build_query( $arg_data['sub_args'] );
669
+				$this->build_query($arg_data['sub_args']);
670 670
 
671 671
 				$this->parent_data = $this->grandparent_data;
672 672
 			}
673 673
 
674
-			if ( isset( $this->entered_join ) ) {
674
+			if (isset($this->entered_join)) {
675 675
 				$this->builder->exit_join();
676 676
 				$this->entered_join = null;
677 677
 			}
678 678
 		}
679 679
 	}
680 680
 
681
-	protected function build_table_schema( $db ) {
681
+	protected function build_table_schema($db) {
682 682
 
683
-		if ( $this->builder->get_table() ) {
683
+		if ($this->builder->get_table()) {
684 684
 
685
-			if ( $this->parent_data['arg'] instanceof WordPoints_Entity_Relationship ) {
685
+			if ($this->parent_data['arg'] instanceof WordPoints_Entity_Relationship) {
686 686
 				$primary_field = $this->parent_data['storage_info']['meta']['field'];
687 687
 				$join_field = $db['id_field'];
688 688
 				//$primary_field = $this->arg_data['arg']->get_secondary_field();
689
-			} elseif ( $this->arg_data['arg'] instanceof WordPoints_Entity_Relationship ) {
689
+			} elseif ($this->arg_data['arg'] instanceof WordPoints_Entity_Relationship) {
690 690
 				$join_field = $db['join_field'];
691 691
 				$primary_field = $this->parent_data['storage_info']['meta']['id_field'];
692 692
 			} else {
693
-				throw new WordPoints_Query_Builder_Exception( 'Houston, we have a problem.' );
693
+				throw new WordPoints_Query_Builder_Exception('Houston, we have a problem.');
694 694
 			}
695 695
 
696
-			if ( is_array( $primary_field ) && isset( $primary_field['table_name'] ) ) {
697
-				$this->builder->enter_join( $primary_field );
696
+			if (is_array($primary_field) && isset($primary_field['table_name'])) {
697
+				$this->builder->enter_join($primary_field);
698 698
 				$primary_field = $primary_field['on']['join_field'];
699 699
 			}
700 700
 
@@ -706,26 +706,26 @@  discard block
 block discarded – undo
706 706
 				),
707 707
 			);
708 708
 
709
-			if ( isset( $db['join_where'] ) ) {
709
+			if (isset($db['join_where'])) {
710 710
 				$join['where'] = $db['join_where'];
711 711
 			}
712 712
 
713
-			$this->builder->enter_join( $join );
713
+			$this->builder->enter_join($join);
714 714
 
715 715
 			$this->entered_join = true;
716 716
 
717 717
 		} else {
718
-			$this->builder->set_table( $db['table_name'] );
719
-			$this->builder->add_field( $db['id_field'] );
718
+			$this->builder->set_table($db['table_name']);
719
+			$this->builder->add_field($db['id_field']);
720 720
 		}
721 721
 	}
722 722
 
723
-	protected function build_conditions( $conditions ) {
723
+	protected function build_conditions($conditions) {
724 724
 
725 725
 		// Join conditions should be pushed to the end.
726 726
 		$join_conditions = array();
727 727
 
728
-		foreach ( $conditions as $condition ) {
728
+		foreach ($conditions as $condition) {
729 729
 
730 730
 			// THis needs to be the identifier field for the type of arg that this
731 731
 			// field represents.
@@ -733,43 +733,43 @@  discard block
 block discarded – undo
733 733
 			// However, for a relationship it could be something else.
734 734
 			// Ultimately, this will have to be left up to the arg object to
735 735
 			// decide.
736
-			if ( ! isset( $condition['field'] ) ) {
737
-				if ( $this->arg_data['arg'] instanceof WordPoints_Entity_Relationship ) {
736
+			if ( ! isset($condition['field'])) {
737
+				if ($this->arg_data['arg'] instanceof WordPoints_Entity_Relationship) {
738 738
 //					$condition['field'] = $this->arg_data['arg']->get_secondary_field();
739 739
 					$condition['field'] = $this->arg_data['storage_info']['meta']['field'];
740 740
 
741
-					if ( is_array( $condition['field'] && isset( $condition['field']['table_name'] ) ) ) {
741
+					if (is_array($condition['field'] && isset($condition['field']['table_name']))) {
742 742
 						$join_conditions[] = $condition;
743 743
 						continue;
744 744
 					}
745
-				} elseif ( $this->arg_data['arg'] instanceof WordPoints_Entity_Attr ) {
745
+				} elseif ($this->arg_data['arg'] instanceof WordPoints_Entity_Attr) {
746 746
 					$condition['field'] = $this->arg_data['arg']->get_field();
747 747
 				} else {
748
-					var_dump($this->arg_data['arg']);exit;
748
+					var_dump($this->arg_data['arg']); exit;
749 749
 				}
750 750
 			}
751 751
 
752
-			$this->builder->where( $condition );
752
+			$this->builder->where($condition);
753 753
 		}
754 754
 
755
-		$join_count = count( $join_conditions );
755
+		$join_count = count($join_conditions);
756 756
 		$i = 0;
757 757
 
758
-		foreach ( $join_conditions as $condition ) {
758
+		foreach ($join_conditions as $condition) {
759 759
 
760 760
 			$i++;
761 761
 
762
-			$this->builder->enter_join( $condition['field'] );
762
+			$this->builder->enter_join($condition['field']);
763 763
 
764 764
 			$condition['field'] = $condition['field']['on']['primary_field'];
765 765
 
766
-			$this->builder->where( $condition );
766
+			$this->builder->where($condition);
767 767
 
768 768
 			$this->builder->exit_join();
769 769
 
770 770
 			// If there are more join conditions, we need to leave a fresh, trailing
771 771
 			// join for the next one to join to.
772
-			if ( $i < $join_count ) {
772
+			if ($i < $join_count) {
773 773
 
774 774
 				// There is a current join, but it is already being used, so we
775 775
 				// need to exit it.
Please login to merge, or discard this patch.
src/includes/classes/hook/settings.php 2 patches
Doc Comments   +20 added lines patch added patch discarded remove patch
@@ -8,12 +8,32 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 interface WordPoints_Hook_Reaction_SettingI {
11
+
12
+	/**
13
+	 * @return void
14
+	 */
11 15
 	public function __construct( $slug );
16
+
17
+	/**
18
+	 * @return string
19
+	 */
12 20
 	public function get_type();
21
+
22
+	/**
23
+	 * @return string
24
+	 */
13 25
 	public function get_label();
26
+
27
+	/**
28
+	 * @return boolean
29
+	 */
14 30
 	public function is_required();
15 31
 	public function get( WordPoints_Hook_ReactionI $reaction );
16 32
 	public function validate( $value, WordPoints_Hook_Reaction_Validator $validator );
33
+
34
+	/**
35
+	 * @return void
36
+	 */
17 37
 	public function save( $value, WordPoints_Hook_ReactionI $reaction, $is_new );
18 38
 }
19 39
 
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 interface WordPoints_Hook_Reaction_SettingI {
11
-	public function __construct( $slug );
11
+	public function __construct($slug);
12 12
 	public function get_type();
13 13
 	public function get_label();
14 14
 	public function is_required();
15
-	public function get( WordPoints_Hook_ReactionI $reaction );
16
-	public function validate( $value, WordPoints_Hook_Reaction_Validator $validator );
17
-	public function save( $value, WordPoints_Hook_ReactionI $reaction, $is_new );
15
+	public function get(WordPoints_Hook_ReactionI $reaction);
16
+	public function validate($value, WordPoints_Hook_Reaction_Validator $validator);
17
+	public function save($value, WordPoints_Hook_ReactionI $reaction, $is_new);
18 18
 }
19 19
 
20 20
 class WordPoints_Hook_Reaction_Setting implements WordPoints_Hook_Reaction_SettingI {
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	protected $type = 'hidden';
24 24
 	protected $required = true;
25 25
 
26
-	public function __construct( $slug ) {
26
+	public function __construct($slug) {
27 27
 		$this->slug = $slug;
28 28
 	}
29 29
 
@@ -39,17 +39,17 @@  discard block
 block discarded – undo
39 39
 		return $this->required;
40 40
 	}
41 41
 
42
-	public function get( WordPoints_Hook_ReactionI $reaction ) {
43
-		return $reaction->get_meta( $this->slug );
42
+	public function get(WordPoints_Hook_ReactionI $reaction) {
43
+		return $reaction->get_meta($this->slug);
44 44
 	}
45 45
 
46
-	public function validate( $value, WordPoints_Hook_Reaction_Validator $validator ) {
46
+	public function validate($value, WordPoints_Hook_Reaction_Validator $validator) {
47 47
 
48
-		if ( $this->is_required() && '' === trim( $value ) ) {
48
+		if ($this->is_required() && '' === trim($value)) {
49 49
 
50 50
 			$validator->add_error(
51 51
 				sprintf(
52
-					__( '%s cannot be empty.', 'wordpoints' )
52
+					__('%s cannot be empty.', 'wordpoints')
53 53
 					, $this->get_label()
54 54
 				)
55 55
 				, $this->slug
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 		return $value;
60 60
 	}
61 61
 
62
-	public function save( $value, WordPoints_Hook_ReactionI $reaction, $is_new ) {
63
-		$reaction->update_meta( $this->slug, $value );
62
+	public function save($value, WordPoints_Hook_ReactionI $reaction, $is_new) {
63
+		$reaction->update_meta($this->slug, $value);
64 64
 	}
65 65
 }
66 66
 //
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
 
83 83
 		$fields = array();
84 84
 
85
-		foreach ( $this->settings as $slug => $class ) {
85
+		foreach ($this->settings as $slug => $class) {
86 86
 
87 87
 			/** @var WordPoints_Hook_Reaction_SettingI $setting */
88
-			$setting = new $class( $slug );
88
+			$setting = new $class($slug);
89 89
 
90
-			$fields[ $slug ] = array(
90
+			$fields[$slug] = array(
91 91
 				'type' => $setting->get_type(),
92 92
 				'label' => $setting->get_label(),
93 93
 				'required' => $setting->is_required(),
@@ -97,29 +97,29 @@  discard block
 block discarded – undo
97 97
 		return $fields;
98 98
 	}
99 99
 
100
-	public function save_settings( $reaction, $settings, $is_new ) {
100
+	public function save_settings($reaction, $settings, $is_new) {
101 101
 
102
-		foreach ( $this->settings as $slug => $class ) {
102
+		foreach ($this->settings as $slug => $class) {
103 103
 
104 104
 			/** @var WordPoints_Hook_Reaction_SettingI $setting */
105
-			$setting = new $class( $slug );
105
+			$setting = new $class($slug);
106 106
 
107
-			$value = isset( $settings[ $slug ] ) ? $settings[ $slug ] : null;
107
+			$value = isset($settings[$slug]) ? $settings[$slug] : null;
108 108
 
109
-			$setting->save( $value, $reaction, $is_new );
109
+			$setting->save($value, $reaction, $is_new);
110 110
 		}
111 111
 	}
112 112
 
113
-	public function validate_settings( $settings, $validator ) {
113
+	public function validate_settings($settings, $validator) {
114 114
 
115
-		foreach ( $this->settings as $slug => $class ) {
115
+		foreach ($this->settings as $slug => $class) {
116 116
 
117 117
 			/** @var WordPoints_Hook_Reaction_SettingI $setting */
118
-			$setting = new $class( $slug );
118
+			$setting = new $class($slug);
119 119
 
120
-			$value = isset( $settings[ $slug ] ) ? $settings[ $slug ] : null;
120
+			$value = isset($settings[$slug]) ? $settings[$slug] : null;
121 121
 
122
-			$settings[ $slug ] = $setting->validate( $value, $validator );
122
+			$settings[$slug] = $setting->validate($value, $validator);
123 123
 		}
124 124
 
125 125
 		return $settings;
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @param WordPoints_Hooks $hooks
135 135
  */
136
-function wordpoints_hook_settings_app( $hooks ) {
137
-	$hooks->sub_apps->register( 'settings', 'WordPoints_Hook_Settings' );
136
+function wordpoints_hook_settings_app($hooks) {
137
+	$hooks->sub_apps->register('settings', 'WordPoints_Hook_Settings');
138 138
 }
139 139
 //add_action( 'wordpoints_hooks_init', 'wordpoints_hook_settings_app' );
140 140
 
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
  *
146 146
  * @param WordPoints_Hook_Settings $settings
147 147
  */
148
-function wordpoints_register_hook_settings( $settings ) {
148
+function wordpoints_register_hook_settings($settings) {
149 149
 
150
-	add_action( 'wordpoints_hook_reaction_save', array( $settings, 'save_settings' ), 10, 3 );
151
-	add_filter( 'wordpoints_hook_reaction_validate', array( $settings, 'validate_settings' ), 10, 2 );
150
+	add_action('wordpoints_hook_reaction_save', array($settings, 'save_settings'), 10, 3);
151
+	add_filter('wordpoints_hook_reaction_validate', array($settings, 'validate_settings'), 10, 2);
152 152
 
153
-	$settings->register( 'description', 'WordPoints_Hook_Reaction_Setting_Description' );
153
+	$settings->register('description', 'WordPoints_Hook_Reaction_Setting_Description');
154 154
 }
155 155
 //add_action( 'wordpoints_hook_settings_init', 'wordpoints_register_hook_settings' );
156 156
 
Please login to merge, or discard this patch.
src/includes/classes/query/builder/db/mysql.php 2 patches
Doc Comments   +24 added lines patch added patch discarded remove patch
@@ -9,12 +9,36 @@
 block discarded – undo
9 9
 
10 10
 
11 11
 interface WordPoints_Query_BuilderI {
12
+
13
+	/**
14
+	 * @return void
15
+	 */
12 16
 	public function set_fields( $fields );
17
+
18
+	/**
19
+	 * @return void
20
+	 */
13 21
 	public function add_field( $field );
22
+
23
+	/**
24
+	 * @return void
25
+	 */
14 26
 	public function set_table( $table_name );
15 27
 	public function get_table();
28
+
29
+	/**
30
+	 * @return void
31
+	 */
16 32
 	public function enter_join( $join );
33
+
34
+	/**
35
+	 * @return void
36
+	 */
17 37
 	public function exit_join();
38
+
39
+	/**
40
+	 * @return void
41
+	 */
18 42
 	public function where( $condition );
19 43
 	public function get_query();
20 44
 }
Please login to merge, or discard this patch.
Spacing   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
 
10 10
 
11 11
 interface WordPoints_Query_BuilderI {
12
-	public function set_fields( $fields );
13
-	public function add_field( $field );
14
-	public function set_table( $table_name );
12
+	public function set_fields($fields);
13
+	public function add_field($field);
14
+	public function set_table($table_name);
15 15
 	public function get_table();
16
-	public function enter_join( $join );
16
+	public function enter_join($join);
17 17
 	public function exit_join();
18
-	public function where( $condition );
18
+	public function where($condition);
19 19
 	public function get_query();
20 20
 }
21 21
 
@@ -33,55 +33,55 @@  discard block
 block discarded – undo
33 33
 	protected $aliases = array();
34 34
 
35 35
 	public function __construct() {
36
-		$this->query = new WordPoints_Hierarchy( 'joins' );
37
-		$this->query->push( '', array() );
36
+		$this->query = new WordPoints_Hierarchy('joins');
37
+		$this->query->push('', array());
38 38
 	}
39 39
 
40
-	public function set_fields( $fields ) {
41
-		$this->query->set_field( 'fields', $fields );
40
+	public function set_fields($fields) {
41
+		$this->query->set_field('fields', $fields);
42 42
 	}
43 43
 
44
-	public function add_field( $field ) {
45
-		$this->query->push_to( 'fields', $field );
44
+	public function add_field($field) {
45
+		$this->query->push_to('fields', $field);
46 46
 	}
47 47
 
48
-	public function set_table( $table_name ) {
49
-		$this->query->set_field( 'table_name',  $table_name );
48
+	public function set_table($table_name) {
49
+		$this->query->set_field('table_name', $table_name);
50 50
 	}
51 51
 
52 52
 	public function get_table() {
53
-		return $this->query->get_field( 'table_name' );
53
+		return $this->query->get_field('table_name');
54 54
 	}
55 55
 
56
-	protected function get_alias( $data ) {
56
+	protected function get_alias($data) {
57 57
 
58
-		if ( ! isset( $this->aliases[ $data['table_name'] ] ) ) {
59
-			$this->aliases[ $data['table_name'] ] = 0;
58
+		if ( ! isset($this->aliases[$data['table_name']])) {
59
+			$this->aliases[$data['table_name']] = 0;
60 60
 		}
61 61
 
62
-		return $data['table_name'] . '_' . ++$this->aliases[ $data['table_name'] ];
62
+		return $data['table_name'].'_'.++$this->aliases[$data['table_name']];
63 63
 	}
64 64
 
65
-	public function enter_join( $join ) {
66
-		$alias = $this->get_alias( $join );
67
-		$this->query->push( $alias, $join );
65
+	public function enter_join($join) {
66
+		$alias = $this->get_alias($join);
67
+		$this->query->push($alias, $join);
68 68
 	}
69 69
 
70 70
 	public function exit_join() {
71 71
 		$this->query->pop();
72 72
 	}
73 73
 
74
-	public function where( $condition ) {
74
+	public function where($condition) {
75 75
 
76
-		$where = $this->query->get_field( 'where' );
76
+		$where = $this->query->get_field('where');
77 77
 
78
-		if ( ! is_array( $where ) ) {
78
+		if ( ! is_array($where)) {
79 79
 			$where = array();
80 80
 		}
81 81
 
82 82
 		$where[] = $condition;
83 83
 
84
-		$this->query->set_field( 'where', $where );
84
+		$this->query->set_field('where', $where);
85 85
 	}
86 86
 }
87 87
 
@@ -101,64 +101,64 @@  discard block
 block discarded – undo
101 101
 
102 102
 		var_dump($this->query);
103 103
 		try {
104
-			$this->build_query( $this->query->get() );
105
-		} catch ( WordPoints_Query_Builder_Exception $e ) {
106
-			return new WP_Error( $e->getMessage(), $e->getTraceAsString() );
104
+			$this->build_query($this->query->get());
105
+		} catch (WordPoints_Query_Builder_Exception $e) {
106
+			return new WP_Error($e->getMessage(), $e->getTraceAsString());
107 107
 		}
108 108
 
109 109
 		return $this->sql;
110 110
 	}
111 111
 
112
-	protected function build_query( $query ) {
112
+	protected function build_query($query) {
113 113
 
114
-		var_dump( __METHOD__, $query );
114
+		var_dump(__METHOD__, $query);
115 115
 
116
-		$this->alias = $this->get_alias( $query );
116
+		$this->alias = $this->get_alias($query);
117 117
 
118
-		$this->build_fields( $query );
119
-		$this->build_from( $query );
120
-		$this->build_joins( $query );
121
-		$this->build_where( $query );
118
+		$this->build_fields($query);
119
+		$this->build_from($query);
120
+		$this->build_joins($query);
121
+		$this->build_where($query);
122 122
 		$this->build_select();
123 123
 	}
124 124
 
125 125
 	protected function build_select() {
126 126
 
127
-		if ( empty( $this->fields ) ) {
128
-			throw new WordPoints_Query_Builder_Exception( 'no fields' );
127
+		if (empty($this->fields)) {
128
+			throw new WordPoints_Query_Builder_Exception('no fields');
129 129
 		}
130 130
 
131
-		$this->sql = 'SELECT' . $this->fields . $this->sql;
131
+		$this->sql = 'SELECT'.$this->fields.$this->sql;
132 132
 	}
133 133
 
134
-	protected function build_fields( $query ) {
134
+	protected function build_fields($query) {
135 135
 
136
-		if ( empty( $query['fields'] ) ) {
136
+		if (empty($query['fields'])) {
137 137
 			return;
138 138
 		}
139 139
 
140
-		foreach ( $query['fields'] as $field ) {
140
+		foreach ($query['fields'] as $field) {
141 141
 
142
-			if ( ! is_array( $field ) ) {
143
-				$field = array( 'field' => $field );
142
+			if ( ! is_array($field)) {
143
+				$field = array('field' => $field);
144 144
 			}
145 145
 
146
-			if ( ! isset( $field['field'] ) ) {
147
-				throw new WordPoints_Query_Builder_Exception( 'invalid field' );
146
+			if ( ! isset($field['field'])) {
147
+				throw new WordPoints_Query_Builder_Exception('invalid field');
148 148
 			}
149 149
 
150
-			if ( ! empty( $this->fields ) ) {
150
+			if ( ! empty($this->fields)) {
151 151
 				$this->fields .= ',';
152 152
 			}
153 153
 
154
-			$this->fields .= ' ' . $this->build_field( $field['field'] );
154
+			$this->fields .= ' '.$this->build_field($field['field']);
155 155
 
156 156
 			$as = $field['field'];
157
-			if ( isset( $field['as'] ) ) {
157
+			if (isset($field['as'])) {
158 158
 				$as = $field['as'];
159 159
 			}
160 160
 
161
-			$this->fields .= ' AS `' . $this->escape_identifier( $as ) . '`';
161
+			$this->fields .= ' AS `'.$this->escape_identifier($as).'`';
162 162
 		}
163 163
 	}
164 164
 
@@ -171,118 +171,118 @@  discard block
 block discarded – undo
171 171
 	 *
172 172
 	 * @throws WordPoints_Query_Builder_Exception
173 173
 	 */
174
-	protected function build_field( $field ) {
174
+	protected function build_field($field) {
175 175
 
176
-		$field_name = $this->get_field_name( $field );
176
+		$field_name = $this->get_field_name($field);
177 177
 
178
-		$sql = '`' . $this->escape_identifier( $this->alias ) . '`';
179
-		$sql .= '.`' . $this->escape_identifier( $field_name ) . '`';
178
+		$sql = '`'.$this->escape_identifier($this->alias).'`';
179
+		$sql .= '.`'.$this->escape_identifier($field_name).'`';
180 180
 
181 181
 		return $sql;
182 182
 	}
183 183
 
184
-	protected function build_from( $query ) {
184
+	protected function build_from($query) {
185 185
 
186
-		if ( ! isset( $query['table_name'] ) ) {
187
-			throw new WordPoints_Query_Builder_Exception( 'table_name' );
186
+		if ( ! isset($query['table_name'])) {
187
+			throw new WordPoints_Query_Builder_Exception('table_name');
188 188
 		}
189 189
 
190 190
 		$this->sql .= "\n";
191
-		$this->sql .= 'FROM `' . $this->escape_identifier( $query['table_name'] ) . '`';
192
-		$this->sql .= ' AS `' . $this->escape_identifier( $this->alias ) . '`';
191
+		$this->sql .= 'FROM `'.$this->escape_identifier($query['table_name']).'`';
192
+		$this->sql .= ' AS `'.$this->escape_identifier($this->alias).'`';
193 193
 	}
194 194
 
195
-	protected function build_joins( $query ) {
195
+	protected function build_joins($query) {
196 196
 
197
-		if ( ! isset( $query['joins'] ) ) {
197
+		if ( ! isset($query['joins'])) {
198 198
 			return;
199 199
 		}
200 200
 
201
-		foreach ( $query['joins'] as $join ) {
202
-			$this->build_join( $join );
201
+		foreach ($query['joins'] as $join) {
202
+			$this->build_join($join);
203 203
 		}
204 204
 	}
205 205
 
206
-	protected function build_join( $join ) {
206
+	protected function build_join($join) {
207 207
 
208
-		if ( ! isset( $join['table_name'] ) ) {
209
-			throw new WordPoints_Query_Builder_Exception( 'join table_name' );
208
+		if ( ! isset($join['table_name'])) {
209
+			throw new WordPoints_Query_Builder_Exception('join table_name');
210 210
 		}
211 211
 
212
-		if ( ! isset( $join['on'] ) ) {
213
-			throw new WordPoints_Query_Builder_Exception( 'join on' );
212
+		if ( ! isset($join['on'])) {
213
+			throw new WordPoints_Query_Builder_Exception('join on');
214 214
 		}
215 215
 
216
-		if ( ! isset( $join['on']['join_field'] ) ) {
217
-			throw new WordPoints_Query_Builder_Exception( 'join on join_field' );
216
+		if ( ! isset($join['on']['join_field'])) {
217
+			throw new WordPoints_Query_Builder_Exception('join on join_field');
218 218
 		}
219 219
 
220
-		if ( ! isset( $join['on']['primary_field'] ) ) {
221
-			throw new WordPoints_Query_Builder_Exception( 'join on primary_field' );
220
+		if ( ! isset($join['on']['primary_field'])) {
221
+			throw new WordPoints_Query_Builder_Exception('join on primary_field');
222 222
 		}
223 223
 
224
-		$alias = $this->get_alias( $join );
224
+		$alias = $this->get_alias($join);
225 225
 
226 226
 		$this->sql .= "\n";
227
-		$this->sql .= 'INNER JOIN `' . $this->escape_identifier( $join['table_name'] ) . '`';
228
-		$this->sql .= ' AS `' . $this->escape_identifier( $alias ) . '`';
229
-		$this->sql .= "\n\t" . 'ON ' . $this->build_field( $join['on']['primary_field'] );
227
+		$this->sql .= 'INNER JOIN `'.$this->escape_identifier($join['table_name']).'`';
228
+		$this->sql .= ' AS `'.$this->escape_identifier($alias).'`';
229
+		$this->sql .= "\n\t".'ON '.$this->build_field($join['on']['primary_field']);
230 230
 
231 231
 		$old_alias = $this->alias;
232 232
 		$this->alias = $alias;
233 233
 
234
-		$this->sql .= ' = ' . $this->build_field( $join['on']['join_field'] );
234
+		$this->sql .= ' = '.$this->build_field($join['on']['join_field']);
235 235
 
236
-		$this->build_fields( $join );
236
+		$this->build_fields($join);
237 237
 
238
-		if ( isset( $join['where'] ) ) {
239
-			foreach ( $join['where'] as $condition ) {
240
-				$this->build_condition( $condition );
238
+		if (isset($join['where'])) {
239
+			foreach ($join['where'] as $condition) {
240
+				$this->build_condition($condition);
241 241
 			}
242 242
 		}
243 243
 
244
-		$this->build_joins( $join );
244
+		$this->build_joins($join);
245 245
 
246 246
 		$this->alias = $old_alias;
247 247
 	}
248 248
 
249
-	protected function build_where( $query ) {
249
+	protected function build_where($query) {
250 250
 
251
-		if ( empty( $query['where'] ) ) {
251
+		if (empty($query['where'])) {
252 252
 			return;
253 253
 		}
254 254
 
255 255
 		$this->sql .= "\n";
256 256
 		$this->sql .= 'WHERE 1=1';
257 257
 
258
-		foreach ( $query['where'] as $condition ) {
259
-			$this->build_condition( $condition );
258
+		foreach ($query['where'] as $condition) {
259
+			$this->build_condition($condition);
260 260
 		}
261 261
 	}
262 262
 
263
-	protected function build_condition( $condition ) {
263
+	protected function build_condition($condition) {
264 264
 
265 265
 		global $wpdb;
266 266
 
267
-		if ( ! isset( $condition['field'], $condition['value'] ) ) {
267
+		if ( ! isset($condition['field'], $condition['value'])) {
268 268
 			var_dump($condition);
269
-			throw new WordPoints_Query_Builder_Exception( 'bad condition' );
269
+			throw new WordPoints_Query_Builder_Exception('bad condition');
270 270
 		}
271 271
 
272
-		if ( ! isset( $condition['compare'] ) ) {
272
+		if ( ! isset($condition['compare'])) {
273 273
 			$condition['compare'] = '=';
274 274
 		}
275 275
 
276 276
 		$this->sql .= "\n\t";
277 277
 
278
-		$this->build_condition_type( $condition );
278
+		$this->build_condition_type($condition);
279 279
 
280
-		$field_type = $this->get_field_type( $condition['field'] );
281
-		if ( 'serialized_array' === $field_type ) {
282
-			if ( is_array( $condition['value'] ) ) {
283
-				if ( isset( $condition['compare'] ) && 'in' === $condition['compare'] ) {
280
+		$field_type = $this->get_field_type($condition['field']);
281
+		if ('serialized_array' === $field_type) {
282
+			if (is_array($condition['value'])) {
283
+				if (isset($condition['compare']) && 'in' === $condition['compare']) {
284 284
 					$this->sql .= '( 1=0 ';
285
-					foreach ( $condition['value'] as $index => $value ) {
285
+					foreach ($condition['value'] as $index => $value) {
286 286
 						$this->build_condition(
287 287
 							array(
288 288
 								'type' => 'or',
@@ -296,13 +296,13 @@  discard block
 block discarded – undo
296 296
 					return;
297 297
 				}
298 298
 			} else {
299
-				$condition['value'] = $this->serialize_value( $condition['value'] );
299
+				$condition['value'] = $this->serialize_value($condition['value']);
300 300
 			}
301 301
 		}
302 302
 
303
-		$this->sql .= $this->build_field( $condition['field'] );
303
+		$this->sql .= $this->build_field($condition['field']);
304 304
 
305
-		switch ( $condition['compare'] ) {
305
+		switch ($condition['compare']) {
306 306
 
307 307
 			case '=':
308 308
 				$this->sql .= ' = ';
@@ -313,18 +313,18 @@  discard block
 block discarded – undo
313 313
 				break;
314 314
 
315 315
 			case 'in':
316
-				$this->sql .= ' IN (' . wordpoints_prepare__in( $condition['value'] ) . ')';
316
+				$this->sql .= ' IN ('.wordpoints_prepare__in($condition['value']).')';
317 317
 				return;
318 318
 
319 319
 			default:
320
-				throw new WordPoints_Query_Builder_Exception( 'bad condition comparison' );
320
+				throw new WordPoints_Query_Builder_Exception('bad condition comparison');
321 321
 		}
322 322
 
323
-		if ( ! is_scalar( $condition['value'] ) ) {
324
-			throw new WordPoints_Query_Builder_Exception( 'bad condition value' );
323
+		if ( ! is_scalar($condition['value'])) {
324
+			throw new WordPoints_Query_Builder_Exception('bad condition value');
325 325
 		}
326 326
 
327
-		$this->sql .= $wpdb->prepare( '%s', $condition['value'] );
327
+		$this->sql .= $wpdb->prepare('%s', $condition['value']);
328 328
 	}
329 329
 
330 330
 	/**
@@ -336,13 +336,13 @@  discard block
 block discarded – undo
336 336
 	 *
337 337
 	 * @throws WordPoints_Query_Builder_Exception
338 338
 	 */
339
-	protected function build_condition_type( $condition ) {
339
+	protected function build_condition_type($condition) {
340 340
 
341
-		if ( ! isset( $condition['type'] ) ) {
341
+		if ( ! isset($condition['type'])) {
342 342
 			$condition['type'] = 'and';
343 343
 		}
344 344
 
345
-		switch ( $condition['type'] ) {
345
+		switch ($condition['type']) {
346 346
 
347 347
 			case 'and':
348 348
 				$this->sql .= 'AND ';
@@ -353,21 +353,21 @@  discard block
 block discarded – undo
353 353
 				break;
354 354
 
355 355
 			default:
356
-				throw new WordPoints_Query_Builder_Exception( 'bad condition type' );
356
+				throw new WordPoints_Query_Builder_Exception('bad condition type');
357 357
 		}
358 358
 	}
359 359
 
360
-	protected function escape_identifier( $identifier ) {
360
+	protected function escape_identifier($identifier) {
361 361
 
362
-		return str_replace( '`', '``', $identifier );
362
+		return str_replace('`', '``', $identifier);
363 363
 	}
364 364
 
365
-	protected function get_field_name( $field ) {
365
+	protected function get_field_name($field) {
366 366
 
367
-		if ( is_array( $field ) ) {
367
+		if (is_array($field)) {
368 368
 
369
-			if ( ! isset( $field['name'] ) ) {
370
-				throw new WordPoints_Query_Builder_Exception( 'field name' );
369
+			if ( ! isset($field['name'])) {
370
+				throw new WordPoints_Query_Builder_Exception('field name');
371 371
 			}
372 372
 
373 373
 			$field = $field['name'];
@@ -376,22 +376,22 @@  discard block
 block discarded – undo
376 376
 		return $field;
377 377
 	}
378 378
 
379
-	protected function get_field_type( $field ) {
379
+	protected function get_field_type($field) {
380 380
 
381
-		if ( is_array( $field ) && isset( $field['type'] ) ) {
381
+		if (is_array($field) && isset($field['type'])) {
382 382
 			return $field['type'];
383 383
 		}
384 384
 
385 385
 		return 'string';
386 386
 	}
387 387
 
388
-	protected function serialize_value( $value ) {
388
+	protected function serialize_value($value) {
389 389
 
390
-		if ( is_string( $value ) ) {
391
-			$value = '"' . $value . '"';
390
+		if (is_string($value)) {
391
+			$value = '"'.$value.'"';
392 392
 		}
393 393
 
394
-		return '%:' . $value . ';%';
394
+		return '%:'.$value.';%';
395 395
 	}
396 396
 }
397 397
 
Please login to merge, or discard this patch.
src/includes/classes/spec.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -284,6 +284,9 @@
 block discarded – undo
284 284
 		return $entities;
285 285
 	}
286 286
 
287
+	/**
288
+	 * @param integer $count
289
+	 */
287 290
 	protected function check_count( $count ) {
288 291
 
289 292
 		if ( isset( $this->settings['max'] ) && $count > $this->settings['max'] ) {
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
 interface WordPoints_SpecI {
12 12
 	public function get_title();
13 13
 	public function get_settings_fields();
14
-	public function validate_settings( $settings );
14
+	public function validate_settings($settings);
15 15
 	public function is_met();
16
-	public function get_error( $name );
16
+	public function get_error($name);
17 17
 }
18 18
 
19 19
 abstract class WordPoints_Spec implements  WordPoints_SpecI {
@@ -25,38 +25,38 @@  discard block
 block discarded – undo
25 25
 	 * @param $value
26 26
 	 * @param $expected
27 27
 	 */
28
-	public function __construct( $value, $expected ) {
28
+	public function __construct($value, $expected) {
29 29
 		$this->value = $value;
30 30
 		$this->expected = $expected;
31 31
 	}
32 32
 
33
-	public function validate_settings( $settings ) {
33
+	public function validate_settings($settings) {
34 34
 
35 35
 		$data_types = wordpoints_apps()->data_types;
36 36
 
37
-		foreach ( $this->get_settings_fields() as $setting => $data ) {
37
+		foreach ($this->get_settings_fields() as $setting => $data) {
38 38
 
39
-			if ( ! isset( $settings[ $setting ] ) ) {
39
+			if ( ! isset($settings[$setting])) {
40 40
 
41
-				if ( ! empty( $data['required'] ) ) {
41
+				if ( ! empty($data['required'])) {
42 42
 					return 'error'; // TODO
43 43
 				}
44 44
 
45 45
 			} else {
46 46
 
47
-				$data_type = $data_types->get( $data['type'] );
47
+				$data_type = $data_types->get($data['type']);
48 48
 
49
-				if ( ! $data_type instanceof WordPoints_Data_TypeI ) {
49
+				if ( ! $data_type instanceof WordPoints_Data_TypeI) {
50 50
 					continue;
51 51
 				}
52 52
 
53
-				$value = $data_type->validate_value( $settings[ $setting ] );
53
+				$value = $data_type->validate_value($settings[$setting]);
54 54
 
55
-				if ( is_wp_error( $value ) ) {
55
+				if (is_wp_error($value)) {
56 56
 					return $value;
57 57
 				}
58 58
 
59
-				$settings[ $setting ] = $value;
59
+				$settings[$setting] = $value;
60 60
 			}
61 61
 		}
62 62
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 class WordPoints_Spec_Number_Max extends WordPoints_Spec {
68 68
 
69 69
 	public function get_title() {
70
-		return __( 'Maximum', 'wordpoints' );
70
+		return __('Maximum', 'wordpoints');
71 71
 	}
72 72
 
73 73
 	public function get_settings_fields() {
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 		return $this->value <= $this->expected;
86 86
 	}
87 87
 
88
-	public function get_error( $name ) {
88
+	public function get_error($name) {
89 89
 
90 90
 		return sprintf(
91
-			__( '%1$s must not be more than %2$s.', 'wordpoints' )
91
+			__('%1$s must not be more than %2$s.', 'wordpoints')
92 92
 			, $name
93 93
 			, $this->expected
94 94
 		);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 class WordPoints_Spec_String_Length_Max extends WordPoints_Spec {
99 99
 
100 100
 	public function get_title() {
101
-		return __( 'Maximum Length', 'wordpoints' );
101
+		return __('Maximum Length', 'wordpoints');
102 102
 	}
103 103
 
104 104
 	public function get_settings_fields() {
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 	}
113 113
 
114 114
 	public function is_met() {
115
-		return strlen( $this->value ) <= $this->expected;
115
+		return strlen($this->value) <= $this->expected;
116 116
 	}
117 117
 
118
-	public function get_error( $name ) {
118
+	public function get_error($name) {
119 119
 
120 120
 		return sprintf(
121
-			__( '%1$s must not be longer than %2$s characters.', 'wordpoints' )
121
+			__('%1$s must not be longer than %2$s characters.', 'wordpoints')
122 122
 			, $name
123 123
 			, $this->expected
124 124
 		);
@@ -129,20 +129,20 @@  discard block
 block discarded – undo
129 129
 class WordPoints_Spec_String_Contains extends WordPoints_Spec {
130 130
 
131 131
 	public function get_title() {
132
-		return __( 'Contains', 'wordpoints' );
132
+		return __('Contains', 'wordpoints');
133 133
 	}
134 134
 
135 135
 	public function get_settings_fields() {
136 136
 	}
137 137
 
138 138
 	public function is_met() {
139
-		return false !== strpos( $this->value, $this->expected );
139
+		return false !== strpos($this->value, $this->expected);
140 140
 	}
141 141
 
142
-	public function get_error( $name ) {
142
+	public function get_error($name) {
143 143
 
144 144
 		return sprintf(
145
-			__( '%1$s must contain "%2$s".', 'wordpoints' ) // TODO quotes
145
+			__('%1$s must contain "%2$s".', 'wordpoints') // TODO quotes
146 146
 			, $name
147 147
 			, $this->expected
148 148
 		);
@@ -165,19 +165,19 @@  discard block
 block discarded – undo
165 165
 	protected $validator;
166 166
 
167 167
 	public function get_title() {
168
-		return __( 'Contains', 'wordpoints' );
168
+		return __('Contains', 'wordpoints');
169 169
 	}
170 170
 
171 171
 	public function get_settings_fields() {
172 172
 		return array(
173 173
 			'min' => array(
174 174
 				'slug'  => 'min',
175
-				'label' => __( 'Minimum number of items', 'wordpoints' ),
175
+				'label' => __('Minimum number of items', 'wordpoints'),
176 176
 				'type'  => 'number',
177 177
 			),
178 178
 			'max' => array(
179 179
 				'slug'  => 'max',
180
-				'label' => __( 'Maximum number of items', 'wordpoints' ),
180
+				'label' => __('Maximum number of items', 'wordpoints'),
181 181
 				'type'  => 'number',
182 182
 			),
183 183
 		);
@@ -189,18 +189,18 @@  discard block
 block discarded – undo
189 189
 		WordPoints_Hook_Reaction_Validator $validator
190 190
 	) {
191 191
 
192
-		if ( ! $this->arg_type_supported( $arg, $validator ) ) {
192
+		if ( ! $this->arg_type_supported($arg, $validator)) {
193 193
 			return false;
194 194
 		}
195 195
 
196 196
 		$this->settings = $settings;
197 197
 		$this->validator = $validator;
198 198
 
199
-		if ( ! $this->validate_count() ) {
199
+		if ( ! $this->validate_count()) {
200 200
 			return false;
201 201
 		}
202 202
 
203
-		if ( isset( $settings['conditions'] ) ) {
203
+		if (isset($settings['conditions'])) {
204 204
 			$this->validate_conditions();
205 205
 		}
206 206
 
@@ -210,21 +210,21 @@  discard block
 block discarded – undo
210 210
 	protected function validate_count() {
211 211
 
212 212
 		if (
213
-			! empty( $this->settings['max'] )
214
-			&& ! wordpoints_posint( $this->settings['max'] )
213
+			! empty($this->settings['max'])
214
+			&& ! wordpoints_posint($this->settings['max'])
215 215
 		) {
216 216
 			$this->validator->add_error(
217
-				__( 'The maximum must be a positive integer.', 'wordpoints' )
217
+				__('The maximum must be a positive integer.', 'wordpoints')
218 218
 				, 'max'
219 219
 			);
220 220
 		}
221 221
 
222 222
 		if (
223
-			! empty( $this->settings['min'] )
224
-			&& ! wordpoints_posint( $this->settings['min'] )
223
+			! empty($this->settings['min'])
224
+			&& ! wordpoints_posint($this->settings['min'])
225 225
 		) {
226 226
 			$this->validator->add_error(
227
-				__( 'The minimum must be a positive integer.', 'wordpoints' )
227
+				__('The minimum must be a positive integer.', 'wordpoints')
228 228
 				, 'min'
229 229
 			);
230 230
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		);
240 240
 
241 241
 		$conditions = $conditions_extension->validate_settings(
242
-			array( 'conditions' => $this->settings['conditions'] )
242
+			array('conditions' => $this->settings['conditions'])
243 243
 			, $this->validator
244 244
 			, $this->validator->get_event_args()
245 245
 		);
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 
250 250
 	public function is_met() {
251 251
 
252
-		$entities = $this->filter_entities( $this->value );
252
+		$entities = $this->filter_entities($this->value);
253 253
 
254
-		return $this->check_count( count( $entities ) );
254
+		return $this->check_count(count($entities));
255 255
 	}
256 256
 
257 257
 	/**
@@ -263,41 +263,41 @@  discard block
 block discarded – undo
263 263
 	 *
264 264
 	 * @return WordPoints_Entity[]
265 265
 	 */
266
-	protected function filter_entities( $entities ) {
266
+	protected function filter_entities($entities) {
267 267
 
268 268
 		$conditions_extension = wordpoints_hooks()->extensions->get(
269 269
 			'conditions'
270 270
 		);
271 271
 
272
-		foreach ( $entities as $index => $entity ) {
272
+		foreach ($entities as $index => $entity) {
273 273
 
274 274
 			$matches = $conditions_extension->conditions_are_met(
275 275
 				$this->expected['conditions']
276
-				, new WordPoints_Hook_Event_Args( array( $entity ) )
276
+				, new WordPoints_Hook_Event_Args(array($entity))
277 277
 			);
278 278
 
279
-			if ( ! $matches ) {
280
-				unset( $entities[ $index ] );
279
+			if ( ! $matches) {
280
+				unset($entities[$index]);
281 281
 			}
282 282
 		}
283 283
 
284 284
 		return $entities;
285 285
 	}
286 286
 
287
-	protected function check_count( $count ) {
287
+	protected function check_count($count) {
288 288
 
289
-		if ( isset( $this->settings['max'] ) && $count > $this->settings['max'] ) {
289
+		if (isset($this->settings['max']) && $count > $this->settings['max']) {
290 290
 			return false;
291 291
 		}
292 292
 
293
-		if ( isset( $this->settings['min'] ) && $count < $this->settings['min'] ) {
293
+		if (isset($this->settings['min']) && $count < $this->settings['min']) {
294 294
 			return false;
295 295
 		}
296 296
 
297 297
 		return true;
298 298
 	}
299 299
 
300
-	public function get_error( $name ) {
300
+	public function get_error($name) {
301 301
 		// TODO: Implement get_error() method.
302 302
 	}
303 303
 }
Please login to merge, or discard this patch.
src/hooks-api.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -44,21 +44,21 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @since 1.0.0
46 46
  */
47
-require_once( dirname( __FILE__ ) . '/includes/constants.php' );
47
+require_once(dirname(__FILE__).'/includes/constants.php');
48 48
 
49 49
 /**
50 50
  * The module's functions.
51 51
  *
52 52
  * @since 1.0.0
53 53
  */
54
-require_once( dirname( __FILE__ ) . '/includes/functions.php' );
54
+require_once(dirname(__FILE__).'/includes/functions.php');
55 55
 
56 56
 /**
57 57
  * The module's actions and filters.
58 58
  *
59 59
  * @since 1.0.0
60 60
  */
61
-require_once( dirname( __FILE__ ) . '/includes/actions.php' );
61
+require_once(dirname(__FILE__).'/includes/actions.php');
62 62
 
63 63
 /**
64 64
  * Class autoloader.
@@ -67,22 +67,22 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @since 1.0.0
69 69
  */
70
-require_once( dirname( __FILE__ ) . '/includes/classes/class/autoloader.php' );
70
+require_once(dirname(__FILE__).'/includes/classes/class/autoloader.php');
71 71
 
72 72
 // Register the classes to autoload.
73 73
 WordPoints_Class_Autoloader::register_dir(
74
-	dirname( __FILE__ ) . '/includes/classes'
74
+	dirname(__FILE__).'/includes/classes'
75 75
 	, 'WordPoints_'
76 76
 );
77 77
 
78
-if ( is_admin() ) {
78
+if (is_admin()) {
79 79
 
80 80
 	/**
81 81
 	 * Administration-side code.
82 82
 	 *
83 83
 	 * @since 1.0.0
84 84
 	 */
85
-	require_once( dirname( __FILE__ ) . '/admin/admin.php' );
85
+	require_once(dirname(__FILE__).'/admin/admin.php');
86 86
 }
87 87
 
88 88
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/app/registry.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,46 +28,46 @@
 block discarded – undo
28 28
 	/**
29 29
 	 * @since 1.0.0
30 30
 	 */
31
-	public function __construct( $slug ) {
31
+	public function __construct($slug) {
32 32
 
33 33
 		$this->registry = new WordPoints_Class_Registry();
34 34
 
35
-		parent::__construct( $slug );
35
+		parent::__construct($slug);
36 36
 	}
37 37
 
38 38
 	/**
39 39
 	 * @since 1.0.0
40 40
 	 */
41
-	public function get_all( array $args = array() ) {
42
-		return $this->registry->get_all( $args );
41
+	public function get_all(array $args = array()) {
42
+		return $this->registry->get_all($args);
43 43
 	}
44 44
 
45 45
 	/**
46 46
 	 * @since 1.0.0
47 47
 	 */
48
-	public function get( $slug, array $args = array() ) {
49
-		return $this->registry->get( $slug, $args );
48
+	public function get($slug, array $args = array()) {
49
+		return $this->registry->get($slug, $args);
50 50
 	}
51 51
 
52 52
 	/**
53 53
 	 * @since 1.0.0
54 54
 	 */
55
-	public function register( $slug, $class, array $args = array() ) {
56
-		return $this->registry->register( $slug, $class, $args );
55
+	public function register($slug, $class, array $args = array()) {
56
+		return $this->registry->register($slug, $class, $args);
57 57
 	}
58 58
 
59 59
 	/**
60 60
 	 * @since 1.0.0
61 61
 	 */
62
-	public function deregister( $slug ) {
63
-		$this->registry->deregister( $slug );
62
+	public function deregister($slug) {
63
+		$this->registry->deregister($slug);
64 64
 	}
65 65
 
66 66
 	/**
67 67
 	 * @since 1.0.0
68 68
 	 */
69
-	public function is_registered( $slug ) {
70
-		return $this->registry->is_registered( $slug );
69
+	public function is_registered($slug) {
70
+		return $this->registry->is_registered($slug);
71 71
 	}
72 72
 }
73 73
 
Please login to merge, or discard this patch.
src/includes/classes/class/autoloader.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 	 * @param string $dir    The full path of the directory.
63 63
 	 * @param string $prefix The prefix used for class names in this directory.
64 64
 	 */
65
-	public static function register_dir( $dir, $prefix ) {
65
+	public static function register_dir($dir, $prefix) {
66 66
 
67
-		if ( ! self::$added_action ) {
68
-			add_action( 'wordpoints_modules_loaded', __CLASS__ . '::init', 0 );
67
+		if ( ! self::$added_action) {
68
+			add_action('wordpoints_modules_loaded', __CLASS__.'::init', 0);
69 69
 			self::$added_action = true;
70 70
 		}
71 71
 
72
-		self::$prefixes[ $prefix ]['length'] = strlen( $prefix );
73
-		self::$prefixes[ $prefix ]['dirs'][] = trailingslashit( $dir );
72
+		self::$prefixes[$prefix]['length'] = strlen($prefix);
73
+		self::$prefixes[$prefix]['dirs'][] = trailingslashit($dir);
74 74
 
75 75
 		self::$sorted = false;
76 76
 	}
@@ -86,31 +86,31 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @param string $class_name The name fo the class to load.
88 88
 	 */
89
-	public static function load_class( $class_name ) {
89
+	public static function load_class($class_name) {
90 90
 
91
-		if ( ! self::$sorted ) {
92
-			arsort( self::$prefixes );
91
+		if ( ! self::$sorted) {
92
+			arsort(self::$prefixes);
93 93
 			self::$sorted = true;
94 94
 		}
95 95
 
96
-		foreach ( self::$prefixes as $prefix => $data ) {
96
+		foreach (self::$prefixes as $prefix => $data) {
97 97
 
98
-			if ( substr( $class_name, 0, $data['length'] ) !== $prefix ) {
98
+			if (substr($class_name, 0, $data['length']) !== $prefix) {
99 99
 				continue;
100 100
 			}
101 101
 
102
-			$trimmed_class_name = substr( $class_name, $data['length'] );
102
+			$trimmed_class_name = substr($class_name, $data['length']);
103 103
 
104
-			$file_name = str_replace( '_', '/', strtolower( $trimmed_class_name ) );
105
-			$file_name = $file_name . '.php';
104
+			$file_name = str_replace('_', '/', strtolower($trimmed_class_name));
105
+			$file_name = $file_name.'.php';
106 106
 
107
-			foreach ( $data['dirs'] as $dir ) {
107
+			foreach ($data['dirs'] as $dir) {
108 108
 
109
-				if ( ! file_exists( $dir . $file_name ) ) {
109
+				if ( ! file_exists($dir.$file_name)) {
110 110
 					continue;
111 111
 				}
112 112
 
113
-				require_once( $dir . $file_name );
113
+				require_once($dir.$file_name);
114 114
 
115 115
 				return;
116 116
 			}
@@ -135,16 +135,16 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public static function init() {
137 137
 
138
-		if ( function_exists( 'spl_autoload_register' ) ) {
138
+		if (function_exists('spl_autoload_register')) {
139 139
 
140
-			spl_autoload_register( __CLASS__ . '::load_class' );
140
+			spl_autoload_register(__CLASS__.'::load_class');
141 141
 
142 142
 		} else {
143 143
 
144
-			foreach ( self::$prefixes as $prefix => $data ) {
145
-				foreach ( $data['dirs'] as $dir ) {
146
-					if ( file_exists( $dir . '/index.php' ) ) {
147
-						require( $dir . '/index.php' );
144
+			foreach (self::$prefixes as $prefix => $data) {
145
+				foreach ($data['dirs'] as $dir) {
146
+					if (file_exists($dir.'/index.php')) {
147
+						require($dir.'/index.php');
148 148
 					}
149 149
 				}
150 150
 			}
Please login to merge, or discard this patch.
src/includes/classes/class/registry/persistent.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 	/**
30 30
 	 * @since 1.0.0
31 31
 	 */
32
-	public function get_all( array $args = array() ) {
32
+	public function get_all(array $args = array()) {
33 33
 
34
-		$classes = array_diff_key( $this->classes, $this->objects );
34
+		$classes = array_diff_key($this->classes, $this->objects);
35 35
 
36
-		if ( ! empty( $classes ) ) {
36
+		if ( ! empty($classes)) {
37 37
 
38 38
 			$objects = WordPoints_Class_Registry::construct_with_args(
39 39
 				$classes
@@ -49,40 +49,40 @@  discard block
 block discarded – undo
49 49
 	/**
50 50
 	 * @since 1.0.0
51 51
 	 */
52
-	public function get( $slug, array $args = array() ) {
52
+	public function get($slug, array $args = array()) {
53 53
 
54
-		if ( ! isset( $this->objects[ $slug ] ) ) {
54
+		if ( ! isset($this->objects[$slug])) {
55 55
 
56
-			$object = parent::get( $slug, $args );
56
+			$object = parent::get($slug, $args);
57 57
 
58
-			if ( ! $object ) {
58
+			if ( ! $object) {
59 59
 				return false;
60 60
 			}
61 61
 
62
-			$this->objects[ $slug ] = $object;
62
+			$this->objects[$slug] = $object;
63 63
 		}
64 64
 
65
-		return $this->objects[ $slug ];
65
+		return $this->objects[$slug];
66 66
 	}
67 67
 
68 68
 	/**
69 69
 	 * @since 1.0.0
70 70
 	 */
71
-	public function register( $slug, $class, array $args = array() ) {
71
+	public function register($slug, $class, array $args = array()) {
72 72
 
73
-		unset( $this->objects[ $slug ] );
73
+		unset($this->objects[$slug]);
74 74
 
75
-		return parent::register( $slug, $class, $args );
75
+		return parent::register($slug, $class, $args);
76 76
 	}
77 77
 
78 78
 	/**
79 79
 	 * @since 1.0.0
80 80
 	 */
81
-	public function deregister( $slug ) {
81
+	public function deregister($slug) {
82 82
 
83
-		parent::deregister( $slug );
83
+		parent::deregister($slug);
84 84
 
85
-		unset( $this->objects[ $slug ] );
85
+		unset($this->objects[$slug]);
86 86
 	}
87 87
 }
88 88
 
Please login to merge, or discard this patch.