Completed
Push — master ( 711d1c...aa04da )
by J.D.
11:00 queued 11:00
created
src/includes/classes/hook/reaction/storage/options.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -22,25 +22,25 @@  discard block
 block discarded – undo
22 22
 	/**
23 23
 	 * @since 1.0.0
24 24
 	 */
25
-	public function reaction_exists( $id ) {
26
-		return (bool) $this->get_option( $this->get_settings_option_name( $id ) );
25
+	public function reaction_exists($id) {
26
+		return (bool) $this->get_option($this->get_settings_option_name($id));
27 27
 	}
28 28
 
29 29
 	/**
30 30
 	 * @since 1.0.0
31 31
 	 */
32 32
 	public function get_reactions() {
33
-		return $this->create_reaction_objects( $this->get_reaction_index() );
33
+		return $this->create_reaction_objects($this->get_reaction_index());
34 34
 	}
35 35
 
36 36
 	/**
37 37
 	 * @since 1.0.0
38 38
 	 */
39
-	public function get_reactions_to_event( $event_slug ) {
39
+	public function get_reactions_to_event($event_slug) {
40 40
 
41 41
 		$index = $this->get_reaction_index();
42
-		$index = wp_list_filter( $index, array( 'event' => $event_slug ) );
43
-		return $this->create_reaction_objects( $index );
42
+		$index = wp_list_filter($index, array('event' => $event_slug));
43
+		return $this->create_reaction_objects($index);
44 44
 	}
45 45
 
46 46
 	/**
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	protected function get_reaction_index() {
61 61
 
62
-		$index = $this->get_option( $this->get_reaction_index_option_name() );
62
+		$index = $this->get_option($this->get_reaction_index_option_name());
63 63
 
64
-		if ( ! is_array( $index ) ) {
64
+		if ( ! is_array($index)) {
65 65
 			$index = array();
66 66
 		}
67 67
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 *
78 78
 	 * @return bool Whether the index was updated successfully.
79 79
 	 */
80
-	protected function update_reaction_index( $index ) {
80
+	protected function update_reaction_index($index) {
81 81
 
82 82
 		return $this->update_option(
83 83
 			$this->get_reaction_index_option_name()
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @return string|false The event slug, or false if not found.
98 98
 	 */
99
-	public function get_reaction_event_from_index( $id ) {
99
+	public function get_reaction_event_from_index($id) {
100 100
 
101 101
 		$index = $this->get_reaction_index();
102 102
 
103
-		if ( ! isset( $index[ $id ]['event'] ) ) {
103
+		if ( ! isset($index[$id]['event'])) {
104 104
 			return false;
105 105
 		}
106 106
 
107
-		return $index[ $id ]['event'];
107
+		return $index[$id]['event'];
108 108
 	}
109 109
 
110 110
 	/**
@@ -119,17 +119,17 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return bool Whether the event was updated successfully.
121 121
 	 */
122
-	public function update_reaction_event_in_index( $id, $event ) {
122
+	public function update_reaction_event_in_index($id, $event) {
123 123
 
124 124
 		$index = $this->get_reaction_index();
125 125
 
126
-		if ( ! isset( $index[ $id ] ) ) {
126
+		if ( ! isset($index[$id])) {
127 127
 			return false;
128 128
 		}
129 129
 
130
-		$index[ $id ]['event'] = $event;
130
+		$index[$id]['event'] = $event;
131 131
 
132
-		return $this->update_reaction_index( $index );
132
+		return $this->update_reaction_index($index);
133 133
 	}
134 134
 
135 135
 	/**
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 	 *
142 142
 	 * @return WordPoints_Hook_Reaction_Options[] The objects for the reactions.
143 143
 	 */
144
-	protected function create_reaction_objects( $index ) {
144
+	protected function create_reaction_objects($index) {
145 145
 
146 146
 		$reactions = array();
147 147
 
148
-		foreach ( $index as $reaction ) {
148
+		foreach ($index as $reaction) {
149 149
 
150
-			$object = $this->get_reaction( $reaction['id'] );
150
+			$object = $this->get_reaction($reaction['id']);
151 151
 
152
-			if ( ! $object ) {
152
+			if ( ! $object) {
153 153
 				continue;
154 154
 			}
155 155
 
@@ -162,53 +162,53 @@  discard block
 block discarded – undo
162 162
 	/**
163 163
 	 * @since 1.0.0
164 164
 	 */
165
-	public function delete_reaction( $id ) {
165
+	public function delete_reaction($id) {
166 166
 
167
-		if ( ! $this->reaction_exists( $id ) ) {
167
+		if ( ! $this->reaction_exists($id)) {
168 168
 			return false;
169 169
 		}
170 170
 
171
-		$result = $this->delete_option( $this->get_settings_option_name( $id ) );
171
+		$result = $this->delete_option($this->get_settings_option_name($id));
172 172
 
173
-		if ( ! $result ) {
173
+		if ( ! $result) {
174 174
 			return false;
175 175
 		}
176 176
 
177 177
 		$index = $this->get_reaction_index();
178 178
 
179
-		unset( $index[ $id ] );
179
+		unset($index[$id]);
180 180
 
181
-		return $this->update_reaction_index( $index );
181
+		return $this->update_reaction_index($index);
182 182
 	}
183 183
 
184 184
 	/**
185 185
 	 * @since 1.0.0
186 186
 	 */
187
-	protected function _create_reaction( $event_slug ) {
187
+	protected function _create_reaction($event_slug) {
188 188
 
189 189
 		$index = $this->get_reaction_index();
190 190
 
191 191
 		$id = 1;
192 192
 
193 193
 		// TODO this is fragile when the newest reaction gets deleted.
194
-		if ( ! empty( $index ) ) {
195
-			$id = 1 + max( array_keys( $index ) );
194
+		if ( ! empty($index)) {
195
+			$id = 1 + max(array_keys($index));
196 196
 		}
197 197
 
198
-		$settings = array( 'event' => $event_slug );
198
+		$settings = array('event' => $event_slug);
199 199
 
200 200
 		$result = $this->add_option(
201
-			$this->get_settings_option_name( $id )
201
+			$this->get_settings_option_name($id)
202 202
 			, $settings
203 203
 		);
204 204
 
205
-		if ( ! $result ) {
205
+		if ( ! $result) {
206 206
 			return false;
207 207
 		}
208 208
 
209
-		$index[ $id ] = array( 'event' => $event_slug, 'id' => $id );
209
+		$index[$id] = array('event' => $event_slug, 'id' => $id);
210 210
 
211
-		if ( ! $this->update_reaction_index( $index ) ) {
211
+		if ( ! $this->update_reaction_index($index)) {
212 212
 			return false;
213 213
 		}
214 214
 
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 *
227 227
 	 * @return mixed The option value, or false.
228 228
 	 */
229
-	public function get_option( $name ) {
230
-		return get_option( $name );
229
+	public function get_option($name) {
230
+		return get_option($name);
231 231
 	}
232 232
 
233 233
 	/**
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return bool Whether the option was added successfully.
242 242
 	 */
243
-	protected function add_option( $name, $value ) {
244
-		return add_option( $name, $value );
243
+	protected function add_option($name, $value) {
244
+		return add_option($name, $value);
245 245
 	}
246 246
 
247 247
 	/**
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 	 *
257 257
 	 * @return bool Whether the option was updated successfully.
258 258
 	 */
259
-	public function update_option( $name, $value ) {
260
-		return update_option( $name, $value );
259
+	public function update_option($name, $value) {
260
+		return update_option($name, $value);
261 261
 	}
262 262
 
263 263
 	/**
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @return bool Whether the option was deleted successfully.
271 271
 	 */
272
-	protected function delete_option( $name ) {
273
-		return delete_option( $name );
272
+	protected function delete_option($name) {
273
+		return delete_option($name);
274 274
 	}
275 275
 
276 276
 	/**
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 *
283 283
 	 * @return string The name of the option where the settings are stored.
284 284
 	 */
285
-	public function get_settings_option_name( $id ) {
285
+	public function get_settings_option_name($id) {
286 286
 		return "wordpoints_{$this->reactor_slug}_hook_reaction-{$id}";
287 287
 	}
288 288
 
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/storage/options/network.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,29 +22,29 @@
 block discarded – undo
22 22
 	/**
23 23
 	 * @since 1.0.0
24 24
 	 */
25
-	public function get_option( $name ) {
26
-		return get_site_option( $name );
25
+	public function get_option($name) {
26
+		return get_site_option($name);
27 27
 	}
28 28
 
29 29
 	/**
30 30
 	 * @since 1.0.0
31 31
 	 */
32
-	protected function add_option( $name, $value ) {
33
-		return add_site_option( $name, $value );
32
+	protected function add_option($name, $value) {
33
+		return add_site_option($name, $value);
34 34
 	}
35 35
 
36 36
 	/**
37 37
 	 * @since 1.0.0
38 38
 	 */
39
-	public function update_option( $name, $value ) {
40
-		return update_site_option( $name, $value );
39
+	public function update_option($name, $value) {
40
+		return update_site_option($name, $value);
41 41
 	}
42 42
 
43 43
 	/**
44 44
 	 * @since 1.0.0
45 45
 	 */
46
-	protected function delete_option( $name ) {
47
-		return delete_site_option( $name );
46
+	protected function delete_option($name) {
47
+		return delete_site_option($name);
48 48
 	}
49 49
 }
50 50
 
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/storagei.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param string $reactor_slug The slug of the reactor the reactions belong to.
26 26
 	 * @param bool   $network_wide Whether this object will store network-wide reactions.
27 27
 	 */
28
-	public function __construct( $reactor_slug, $network_wide );
28
+	public function __construct($reactor_slug, $network_wide);
29 29
 
30 30
 	/**
31 31
 	 * Get the slug of the reactor this object stores reactions for.
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return bool Whether the reaction exists.
56 56
 	 */
57
-	public function reaction_exists( $id );
57
+	public function reaction_exists($id);
58 58
 
59 59
 	/**
60 60
 	 * Get an reaction object.
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @return WordPoints_Hook_ReactionI|false The reaction, or false if nonexistent.
67 67
 	 */
68
-	public function get_reaction( $id );
68
+	public function get_reaction($id);
69 69
 
70 70
 	/**
71 71
 	 * Create an reaction.
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *         The reaction object if created successfully. False or a validator
79 79
 	 *         instance if not.
80 80
 	 */
81
-	public function create_reaction( array $settings );
81
+	public function create_reaction(array $settings);
82 82
 
83 83
 	/**
84 84
 	 * Update an reaction.
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 *         The reaction object if updated successfully. False or a validator
93 93
 	 *         instance if not.
94 94
 	 */
95
-	public function update_reaction( $id, array $settings );
95
+	public function update_reaction($id, array $settings);
96 96
 
97 97
 	/**
98 98
 	 * Delete an reaction.
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @return bool Whether the reaction was deleted successfully.
105 105
 	 */
106
-	public function delete_reaction( $id );
106
+	public function delete_reaction($id);
107 107
 
108 108
 	/**
109 109
 	 * Get all hook reactions for the reactor.
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @return WordPoints_Hook_ReactionI[]
128 128
 	 */
129
-	public function get_reactions_to_event( $event_slug );
129
+	public function get_reactions_to_event($event_slug);
130 130
 }
131 131
 
132 132
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/validator.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 	 * @param bool                            $fail_fast Whether to fail as soon as
105 105
 	 *                                                   the first error is found.
106 106
 	 */
107
-	public function __construct( $settings, WordPoints_Hook_Reactor $reactor, $fail_fast = false ) {
107
+	public function __construct($settings, WordPoints_Hook_Reactor $reactor, $fail_fast = false) {
108 108
 
109 109
 		$this->reactor = $reactor;
110 110
 		$this->fail_fast = $fail_fast;
111 111
 		$this->hooks = wordpoints_hooks();
112 112
 
113
-		if ( $settings instanceof WordPoints_Hook_ReactionI ) {
113
+		if ($settings instanceof WordPoints_Hook_ReactionI) {
114 114
 
115 115
 			$this->reaction   = $settings;
116 116
 			$this->settings   = $this->reaction->get_all_meta();
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
 			$this->settings = $settings;
122 122
 
123
-			if ( isset( $this->settings['event'] ) ) {
123
+			if (isset($this->settings['event'])) {
124 124
 				$this->event_slug = $this->settings['event'];
125 125
 			}
126 126
 		}
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 			$fail_fast = $this->fail_fast;
145 145
 			$this->fail_fast = true;
146 146
 
147
-			if ( ! isset( $this->event_slug ) ) {
148
-				$this->add_error( __( 'Event is missing.', 'wordpoints' ), 'event' );
149
-			} elseif ( ! $this->hooks->events->is_registered( $this->event_slug ) ) {
150
-				$this->add_error( __( 'Event is invalid.', 'wordpoints' ), 'event' );
147
+			if ( ! isset($this->event_slug)) {
148
+				$this->add_error(__('Event is missing.', 'wordpoints'), 'event');
149
+			} elseif ( ! $this->hooks->events->is_registered($this->event_slug)) {
150
+				$this->add_error(__('Event is invalid.', 'wordpoints'), 'event');
151 151
 			}
152 152
 
153 153
 			// From here on out we can collect errors as they come (unless we are
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 				$this->event_slug
159 159
 			);
160 160
 
161
-			$this->event_args = new WordPoints_Hook_Event_Args( $event_args );
162
-			$this->event_args->set_validator( $this );
161
+			$this->event_args = new WordPoints_Hook_Event_Args($event_args);
162
+			$this->event_args->set_validator($this);
163 163
 
164
-			$this->settings = $this->reactor->validate_settings( $this->settings, $this, $this->event_args );
164
+			$this->settings = $this->reactor->validate_settings($this->settings, $this, $this->event_args);
165 165
 
166 166
 			/** @var WordPoints_Hook_Extension $extension */
167
-			foreach ( $this->hooks->extensions->get_all() as $extension ) {
168
-				$this->settings = $extension->validate_settings( $this->settings, $this, $this->event_args );
167
+			foreach ($this->hooks->extensions->get_all() as $extension) {
168
+				$this->settings = $extension->validate_settings($this->settings, $this, $this->event_args);
169 169
 			}
170 170
 
171 171
 			/**
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
 			 * @param WordPoints_Hook_Reaction_Validator $validator The validator object.
176 176
 			 * @param WordPoints_Hook_Event_Args         $args      The event args object.
177 177
 			 */
178
-			$this->settings = apply_filters( 'wordpoints_hook_reaction_validate', $this->settings, $this, $this->event_args );
178
+			$this->settings = apply_filters('wordpoints_hook_reaction_validate', $this->settings, $this, $this->event_args);
179 179
 
180
-		} catch ( WordPoints_Hook_Validator_Exception $e ) {
180
+		} catch (WordPoints_Hook_Validator_Exception $e) {
181 181
 
182 182
 			// Do nothing.
183
-			unset( $e );
183
+			unset($e);
184 184
 		}
185 185
 
186 186
 		return $this->settings;
@@ -208,17 +208,17 @@  discard block
 block discarded – undo
208 208
 	 * @throws WordPoints_Hook_Validator_Exception If the validator is configured to
209 209
 	 *                                             fail as soon as an error is found.
210 210
 	 */
211
-	public function add_error( $message, $field = null ) {
211
+	public function add_error($message, $field = null) {
212 212
 
213 213
 		$field_stack = $this->field_stack;
214 214
 
215
-		if ( ! empty( $field ) ) {
215
+		if ( ! empty($field)) {
216 216
 			$field_stack[] = $field;
217 217
 		}
218 218
 
219
-		$this->errors[] = array( 'message' => $message, 'field' => $field_stack );
219
+		$this->errors[] = array('message' => $message, 'field' => $field_stack);
220 220
 
221
-		if ( $this->fail_fast ) {
221
+		if ($this->fail_fast) {
222 222
 			throw new WordPoints_Hook_Validator_Exception;
223 223
 		}
224 224
 	}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * @return bool Whether the validator found any errors.
232 232
 	 */
233 233
 	public function had_errors() {
234
-		return ! empty( $this->errors );
234
+		return ! empty($this->errors);
235 235
 	}
236 236
 
237 237
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @param string $field The field.
254 254
 	 */
255
-	public function push_field( $field ) {
255
+	public function push_field($field) {
256 256
 		$this->field_stack[] = $field;
257 257
 	}
258 258
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @since 1.0.0
263 263
 	 */
264 264
 	public function pop_field() {
265
-		array_pop( $this->field_stack );
265
+		array_pop($this->field_stack);
266 266
 	}
267 267
 
268 268
 	/**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 */
308 308
 	public function get_id() {
309 309
 
310
-		if ( ! $this->reaction ) {
310
+		if ( ! $this->reaction) {
311 311
 			return false;
312 312
 		}
313 313
 
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
 	 *
346 346
 	 * @return mixed The meta value.
347 347
 	 */
348
-	public function get_meta( $key ) {
348
+	public function get_meta($key) {
349 349
 
350
-		if ( ! isset( $this->settings[ $key ] ) ) {
350
+		if ( ! isset($this->settings[$key])) {
351 351
 			return null;
352 352
 		}
353 353
 
354
-		return $this->settings[ $key ];
354
+		return $this->settings[$key];
355 355
 	}
356 356
 
357 357
 	/**
Please login to merge, or discard this patch.
src/includes/classes/hook/reactioni.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param int                               $id      The ID of a hook reaction.
26 26
 	 * @param WordPoints_Hook_Reaction_StorageI $storage The storage object.
27 27
 	 */
28
-	public function __construct( $id, WordPoints_Hook_Reaction_StorageI $storage );
28
+	public function __construct($id, WordPoints_Hook_Reaction_StorageI $storage);
29 29
 
30 30
 	/**
31 31
 	 * Check whether this reaction is network-wide.
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return bool Whether the event was updated successfully.
56 56
 	 */
57
-	public function update_event_slug( $event_slug );
57
+	public function update_event_slug($event_slug);
58 58
 
59 59
 	/**
60 60
 	 * Get the slug of the reactor this reaction is for.
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return mixed|false The meta value, or false if not found.
76 76
 	 */
77
-	public function get_meta( $key );
77
+	public function get_meta($key);
78 78
 
79 79
 	/**
80 80
 	 * Add a piece of metadata for this reaction.
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return bool Whether the metadata was added successfully.
90 90
 	 */
91
-	public function add_meta( $key, $value );
91
+	public function add_meta($key, $value);
92 92
 
93 93
 	/**
94 94
 	 * Update a piece of metadata for this reaction.
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @return bool Whether the metadata was updated successfully.
102 102
 	 */
103
-	public function update_meta( $key, $value );
103
+	public function update_meta($key, $value);
104 104
 
105 105
 	/**
106 106
 	 * Delete a piece of metadata for this reaction.
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @return bool Whether the metadata was deleted successfully.
113 113
 	 */
114
-	public function delete_meta( $key );
114
+	public function delete_meta($key);
115 115
 
116 116
 	/**
117 117
 	 * Get all of the metadata for this reaction.
Please login to merge, or discard this patch.
src/includes/classes/hook/reactor.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
 	/**
70 70
 	 * @since 1.0.0
71 71
 	 */
72
-	public function __get( $var ) {
72
+	public function __get($var) {
73 73
 
74 74
 		if (
75 75
 			'reactions' === $var
76 76
 			|| (
77 77
 				'network_reactions' === $var
78
-				&& isset( $this->network_reactions_class )
78
+				&& isset($this->network_reactions_class)
79 79
 			)
80 80
 		) {
81
-			if ( ! isset( $this->$var ) ) {
81
+			if ( ! isset($this->$var)) {
82 82
 				$this->$var = new $this->{"{$var}_class"}(
83 83
 					$this->slug
84
-					, ( 'network_reactions' === $var )
84
+					, ('network_reactions' === $var)
85 85
 				);
86 86
 			}
87 87
 
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return WordPoints_Hook_ReactionI[] All of the reaction objects.
135 135
 	 */
136
-	public function get_all_reactions_to_event( $event_slug ) {
136
+	public function get_all_reactions_to_event($event_slug) {
137 137
 
138
-		$reactions = $this->reactions->get_reactions_to_event( $event_slug );
138
+		$reactions = $this->reactions->get_reactions_to_event($event_slug);
139 139
 
140 140
 		if (
141
-			isset( $this->network_reactions_class )
141
+			isset($this->network_reactions_class)
142 142
 			&& is_wordpoints_network_active()
143 143
 		) {
144 144
 			$reactions = array_merge(
145 145
 				$reactions
146
-				, $this->network_reactions->get_reactions_to_event( $event_slug )
146
+				, $this->network_reactions->get_reactions_to_event($event_slug)
147 147
 			);
148 148
 		}
149 149
 
@@ -160,21 +160,21 @@  discard block
 block discarded – undo
160 160
 	) {
161 161
 
162 162
 		if (
163
-			empty( $settings['target'] )
164
-			|| ! is_array( $settings['target'] )
163
+			empty($settings['target'])
164
+			|| ! is_array($settings['target'])
165 165
 		) {
166 166
 
167
-			$validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' );
167
+			$validator->add_error(__('Invalid target.', 'wordpoints'), 'target');
168 168
 
169 169
 		} else {
170 170
 
171
-			$target = $event_args->get_from_hierarchy( $settings['target'] );
171
+			$target = $event_args->get_from_hierarchy($settings['target']);
172 172
 
173 173
 			if (
174 174
 				! $target instanceof WordPoints_Entity
175
-				|| ! in_array( $target->get_slug(), (array) $this->arg_types )
175
+				|| ! in_array($target->get_slug(), (array) $this->arg_types)
176 176
 			) {
177
-				$validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' );
177
+				$validator->add_error(__('Invalid target.', 'wordpoints'), 'target');
178 178
 			}
179 179
 		}
180 180
 
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 	/**
185 185
 	 * @since 1.0.0
186 186
 	 */
187
-	public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) {
188
-		$reaction->update_meta( 'target', $settings['target'] );
187
+	public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) {
188
+		$reaction->update_meta('target', $settings['target']);
189 189
 	}
190 190
 
191 191
 	/**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 * @param WordPoints_Hook_Event_Args         $event_args The event args.
197 197
 	 * @param WordPoints_Hook_Reaction_Validator $reaction   The reaction.
198 198
 	 */
199
-	abstract public function hit( WordPoints_Hook_Event_Args $event_args, WordPoints_Hook_Reaction_Validator $reaction );
199
+	abstract public function hit(WordPoints_Hook_Event_Args $event_args, WordPoints_Hook_Reaction_Validator $reaction);
200 200
 }
201 201
 
202 202
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/reactor/points.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function get_settings_fields() {
57 57
 
58
-		$this->settings_fields['points']['label'] = _x( 'Points', 'form label', 'wordpoints' );
59
-		$this->settings_fields['log_text']['label'] = _x( 'Log Text', 'form label', 'wordpoints' );
60
-		$this->settings_fields['description']['label'] = _x( 'Description', 'form label', 'wordpoints' );
58
+		$this->settings_fields['points']['label'] = _x('Points', 'form label', 'wordpoints');
59
+		$this->settings_fields['log_text']['label'] = _x('Log Text', 'form label', 'wordpoints');
60
+		$this->settings_fields['description']['label'] = _x('Description', 'form label', 'wordpoints');
61 61
 
62 62
 		return parent::get_settings_fields();
63 63
 	}
@@ -71,23 +71,23 @@  discard block
 block discarded – undo
71 71
 		WordPoints_Hook_Event_Args $event_args
72 72
 	) {
73 73
 
74
-		if ( ! isset( $settings['points'] ) || false === wordpoints_int( $settings['points'] ) ) {
75
-			$validator->add_error( __( 'Points must be an integer.', 'wordpoints' ), 'points' );
74
+		if ( ! isset($settings['points']) || false === wordpoints_int($settings['points'])) {
75
+			$validator->add_error(__('Points must be an integer.', 'wordpoints'), 'points');
76 76
 		}
77 77
 
78
-		if ( ! isset( $settings['points_type'] ) || ! wordpoints_is_points_type( $settings['points_type'] ) ) {
79
-			$validator->add_error( __( 'Invalid points type.', 'wordpoints' ), 'points_type' );
78
+		if ( ! isset($settings['points_type']) || ! wordpoints_is_points_type($settings['points_type'])) {
79
+			$validator->add_error(__('Invalid points type.', 'wordpoints'), 'points_type');
80 80
 		}
81 81
 
82
-		if ( ! isset( $settings['description'] ) ) {
83
-			$validator->add_error( __( 'Description is required.', 'wordpoints' ), 'description' );
82
+		if ( ! isset($settings['description'])) {
83
+			$validator->add_error(__('Description is required.', 'wordpoints'), 'description');
84 84
 		}
85 85
 
86
-		if ( ! isset( $settings['log_text'] ) ) {
87
-			$validator->add_error( __( 'Log Text is required.', 'wordpoints' ), 'log_text' );
86
+		if ( ! isset($settings['log_text'])) {
87
+			$validator->add_error(__('Log Text is required.', 'wordpoints'), 'log_text');
88 88
 		}
89 89
 
90
-		return parent::validate_settings( $settings, $validator, $event_args );
90
+		return parent::validate_settings($settings, $validator, $event_args);
91 91
 	}
92 92
 
93 93
 	/**
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 		array $settings
99 99
 	) {
100 100
 
101
-		parent::update_settings( $reaction, $settings );
101
+		parent::update_settings($reaction, $settings);
102 102
 
103
-		$reaction->update_meta( 'points', $settings['points'] );
104
-		$reaction->update_meta( 'points_type', $settings['points_type'] );
105
-		$reaction->update_meta( 'description', $settings['description'] );
106
-		$reaction->update_meta( 'log_text', $settings['log_text'] );
103
+		$reaction->update_meta('points', $settings['points']);
104
+		$reaction->update_meta('points_type', $settings['points_type']);
105
+		$reaction->update_meta('description', $settings['description']);
106
+		$reaction->update_meta('log_text', $settings['log_text']);
107 107
 	}
108 108
 
109 109
 	/**
@@ -115,33 +115,33 @@  discard block
 block discarded – undo
115 115
 	) {
116 116
 
117 117
 		$target = $event_args->get_from_hierarchy(
118
-			$reaction->get_meta( 'target' )
118
+			$reaction->get_meta('target')
119 119
 		);
120 120
 
121
-		if ( ! $target instanceof WordPoints_Entity ) {
121
+		if ( ! $target instanceof WordPoints_Entity) {
122 122
 			return;
123 123
 		}
124 124
 
125 125
 		$meta = array();
126 126
 
127
-		foreach ( $event_args->get_entities() as $entity ) {
128
-			$meta[ $entity->get_slug() ] = $entity->get_the_id();
127
+		foreach ($event_args->get_entities() as $entity) {
128
+			$meta[$entity->get_slug()] = $entity->get_the_id();
129 129
 		}
130 130
 
131 131
 		wordpoints_alter_points(
132 132
 			$target->get_the_id()
133
-			, $reaction->get_meta( 'points' )
134
-			, $reaction->get_meta( 'points_type' )
133
+			, $reaction->get_meta('points')
134
+			, $reaction->get_meta('points_type')
135 135
 			, $reaction->get_event_slug()
136 136
 			, $meta
137
-			, $reaction->get_meta( 'log_text' )
137
+			, $reaction->get_meta('log_text')
138 138
 		);
139 139
 	}
140 140
 
141 141
 	/**
142 142
 	 * @since 1.0.0
143 143
 	 */
144
-	public function spam_hits( $event_slug, WordPoints_Hook_Event_Args $event_args ) {
144
+	public function spam_hits($event_slug, WordPoints_Hook_Event_Args $event_args) {
145 145
 
146 146
 		$meta_queries = array(
147 147
 			array(
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 			),
153 153
 		);
154 154
 
155
-		foreach ( $event_args->get_entities() as $slug => $entity ) {
155
+		foreach ($event_args->get_entities() as $slug => $entity) {
156 156
 
157 157
 			$meta_queries[] = array(
158 158
 				'key'   => $slug,
@@ -169,35 +169,35 @@  discard block
 block discarded – undo
169 169
 
170 170
 		$logs = $query->get();
171 171
 
172
-		if ( ! $logs ) {
172
+		if ( ! $logs) {
173 173
 			return;
174 174
 		}
175 175
 
176 176
 		global $wpdb;
177 177
 
178
-		add_filter( 'wordpoints_points_log', '__return_false' );
178
+		add_filter('wordpoints_points_log', '__return_false');
179 179
 
180
-		foreach ( $logs as $log ) {
180
+		foreach ($logs as $log) {
181 181
 
182 182
 			wordpoints_alter_points(
183 183
 				$log->user_id
184 184
 				, -$log->points
185 185
 				, $log->points_type
186 186
 				, "spam-{$log->log_type}"
187
-				, array( 'original_log_id' => $log->id )
187
+				, array('original_log_id' => $log->id)
188 188
 			);
189 189
 
190
-			wordpoints_points_log_delete_all_metadata( $log->id );
190
+			wordpoints_points_log_delete_all_metadata($log->id);
191 191
 
192 192
 			// Now delete the log.
193 193
 			$wpdb->delete(
194 194
 				$wpdb->wordpoints_points_logs
195
-				, array( 'id' => $log->id )
195
+				, array('id' => $log->id)
196 196
 				, '%d'
197 197
 			); // WPCS: cache OK, cleaned by wordpoints_alter_points().
198 198
 		}
199 199
 
200
-		remove_filter( 'wordpoints_points_log', '__return_false' );
200
+		remove_filter('wordpoints_points_log', '__return_false');
201 201
 	}
202 202
 }
203 203
 
Please login to merge, or discard this patch.
src/includes/classes/hook/reactor/reversei.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	 * @param string                     $event_slug The event slug.
23 23
 	 * @param WordPoints_Hook_Event_Args $event_args The event args.
24 24
 	 */
25
-	public function reverse_hits( $event_slug, WordPoints_Hook_Event_Args $event_args );
25
+	public function reverse_hits($event_slug, WordPoints_Hook_Event_Args $event_args);
26 26
 }
27 27
 
28 28
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/reactor/spami.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	 * @param string                     $event_slug The event slug.
23 23
 	 * @param WordPoints_Hook_Event_Args $event_args The event args.
24 24
 	 */
25
-	public function spam_hits( $event_slug, WordPoints_Hook_Event_Args $event_args );
25
+	public function spam_hits($event_slug, WordPoints_Hook_Event_Args $event_args);
26 26
 }
27 27
 
28 28
 // EOF
Please login to merge, or discard this patch.