Completed
Push — master ( 760553...dce43d )
by J.D.
03:49
created
src/classes/hook/fire.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function hit() {
90 90
 
91
-		if ( ! $this->hit_id ) {
91
+		if ( ! $this->hit_id) {
92 92
 
93 93
 			$this->hit_id = $this->log_hit();
94 94
 
95
-			if ( ! $this->hit_id ) {
95
+			if ( ! $this->hit_id) {
96 96
 				return false;
97 97
 			}
98 98
 		}
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 					$this->reaction->get_context_id()
129 129
 				),
130 130
 				'reaction_id' => $this->reaction->get_id(),
131
-				'date' => current_time( 'mysql', true ),
131
+				'date' => current_time('mysql', true),
132 132
 			)
133 133
 		);
134 134
 
135
-		if ( ! $inserted ) {
135
+		if ( ! $inserted) {
136 136
 			return false;
137 137
 		}
138 138
 
Please login to merge, or discard this patch.
src/classes/hook/reaction/storei.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @return bool Whether the reaction exists.
61 61
 	 */
62
-	public function reaction_exists( $id );
62
+	public function reaction_exists($id);
63 63
 
64 64
 	/**
65 65
 	 * Get an reaction object.
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @return WordPoints_Hook_ReactionI|false The reaction, or false if nonexistent.
72 72
 	 */
73
-	public function get_reaction( $id );
73
+	public function get_reaction($id);
74 74
 
75 75
 	/**
76 76
 	 * Create an reaction.
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *         The reaction object if created successfully. False or a validator
84 84
 	 *         instance if not.
85 85
 	 */
86
-	public function create_reaction( array $settings );
86
+	public function create_reaction(array $settings);
87 87
 
88 88
 	/**
89 89
 	 * Update an reaction.
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 *         The reaction object if updated successfully. False or a validator
98 98
 	 *         instance if not.
99 99
 	 */
100
-	public function update_reaction( $id, array $settings );
100
+	public function update_reaction($id, array $settings);
101 101
 
102 102
 	/**
103 103
 	 * Delete an reaction.
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return bool Whether the reaction was deleted successfully.
110 110
 	 */
111
-	public function delete_reaction( $id );
111
+	public function delete_reaction($id);
112 112
 
113 113
 	/**
114 114
 	 * Get all hook reactions for the reactor.
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return WordPoints_Hook_ReactionI[]
133 133
 	 */
134
-	public function get_reactions_to_event( $event_slug );
134
+	public function get_reactions_to_event($event_slug);
135 135
 }
136 136
 
137 137
 // EOF
Please login to merge, or discard this patch.
src/classes/hook/reaction/store/options/network.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,29 +27,29 @@
 block discarded – undo
27 27
 	/**
28 28
 	 * @since 2.1.0
29 29
 	 */
30
-	public function get_option( $name ) {
31
-		return get_site_option( $name );
30
+	public function get_option($name) {
31
+		return get_site_option($name);
32 32
 	}
33 33
 
34 34
 	/**
35 35
 	 * @since 2.1.0
36 36
 	 */
37
-	protected function add_option( $name, $value ) {
38
-		return add_site_option( $name, $value );
37
+	protected function add_option($name, $value) {
38
+		return add_site_option($name, $value);
39 39
 	}
40 40
 
41 41
 	/**
42 42
 	 * @since 2.1.0
43 43
 	 */
44
-	public function update_option( $name, $value ) {
45
-		return update_site_option( $name, $value );
44
+	public function update_option($name, $value) {
45
+		return update_site_option($name, $value);
46 46
 	}
47 47
 
48 48
 	/**
49 49
 	 * @since 2.1.0
50 50
 	 */
51
-	protected function delete_option( $name ) {
52
-		return delete_site_option( $name );
51
+	protected function delete_option($name) {
52
+		return delete_site_option($name);
53 53
 	}
54 54
 }
55 55
 
Please login to merge, or discard this patch.
src/classes/hook/reaction/store/options.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -22,25 +22,25 @@  discard block
 block discarded – undo
22 22
 	/**
23 23
 	 * @since 2.1.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 2.1.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 2.1.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,52 +162,52 @@  discard block
 block discarded – undo
162 162
 	/**
163 163
 	 * @since 2.1.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 2.1.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
-		$id = $this->get_next_id( $index );
191
+		$id = $this->get_next_id($index);
192 192
 
193
-		$settings = array( 'event' => $event_slug );
193
+		$settings = array('event' => $event_slug);
194 194
 
195 195
 		$result = $this->add_option(
196
-			$this->get_settings_option_name( $id )
196
+			$this->get_settings_option_name($id)
197 197
 			, $settings
198 198
 		);
199 199
 
200
-		if ( ! $result ) {
200
+		if ( ! $result) {
201 201
 			return false;
202 202
 		}
203 203
 
204
-		$index[ $id ] = array( 'event' => $event_slug, 'id' => $id );
204
+		$index[$id] = array('event' => $event_slug, 'id' => $id);
205 205
 
206
-		if ( ! $this->update_reaction_index( $index ) ) {
206
+		if ( ! $this->update_reaction_index($index)) {
207 207
 			return false;
208 208
 		}
209 209
 
210
-		$this->update_option( $this->get_last_reaction_id_option_name(), $id );
210
+		$this->update_option($this->get_last_reaction_id_option_name(), $id);
211 211
 
212 212
 		return $id;
213 213
 	}
@@ -221,23 +221,23 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @return int The ID to use for the next reaction.
223 223
 	 */
224
-	protected function get_next_id( $index ) {
224
+	protected function get_next_id($index) {
225 225
 
226 226
 		$id = 1;
227 227
 
228
-		$last_id = $this->get_option( $this->get_last_reaction_id_option_name() );
228
+		$last_id = $this->get_option($this->get_last_reaction_id_option_name());
229 229
 
230
-		if ( wordpoints_posint( $last_id ) ) {
230
+		if (wordpoints_posint($last_id)) {
231 231
 			$id = $last_id + 1;
232 232
 		}
233 233
 
234 234
 		// Double-check this against the index. This should avoid some issues from
235 235
 		// race conditions.
236
-		if ( ! empty( $index ) ) {
236
+		if ( ! empty($index)) {
237 237
 
238
-			$max = max( array_keys( $index ) );
238
+			$max = max(array_keys($index));
239 239
 
240
-			if ( $max >= $id ) {
240
+			if ($max >= $id) {
241 241
 				$id = $max + 1;
242 242
 			}
243 243
 		}
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 	 *
257 257
 	 * @return mixed The option value, or false.
258 258
 	 */
259
-	public function get_option( $name ) {
260
-		return get_option( $name );
259
+	public function get_option($name) {
260
+		return get_option($name);
261 261
 	}
262 262
 
263 263
 	/**
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 *
271 271
 	 * @return bool Whether the option was added successfully.
272 272
 	 */
273
-	protected function add_option( $name, $value ) {
274
-		return add_option( $name, $value );
273
+	protected function add_option($name, $value) {
274
+		return add_option($name, $value);
275 275
 	}
276 276
 
277 277
 	/**
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * @return bool Whether the option was updated successfully.
288 288
 	 */
289
-	public function update_option( $name, $value ) {
290
-		return update_option( $name, $value );
289
+	public function update_option($name, $value) {
290
+		return update_option($name, $value);
291 291
 	}
292 292
 
293 293
 	/**
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @return bool Whether the option was deleted successfully.
301 301
 	 */
302
-	protected function delete_option( $name ) {
303
-		return delete_option( $name );
302
+	protected function delete_option($name) {
303
+		return delete_option($name);
304 304
 	}
305 305
 
306 306
 	/**
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @return string The name of the option where the settings are stored.
316 316
 	 */
317
-	public function get_settings_option_name( $id ) {
317
+	public function get_settings_option_name($id) {
318 318
 		return "wordpoints_hook_reaction-{$this->slug}-{$this->mode_slug}-{$id}";
319 319
 	}
320 320
 
Please login to merge, or discard this patch.
src/classes/hook/reaction/options.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 	 * @since 2.1.0
26 26
 	 */
27 27
 	public function get_event_slug() {
28
-		return $this->store->get_reaction_event_from_index( $this->ID );
28
+		return $this->store->get_reaction_event_from_index($this->ID);
29 29
 	}
30 30
 
31 31
 	/**
32 32
 	 * @since 2.1.0
33 33
 	 */
34
-	public function update_event_slug( $event_slug ) {
34
+	public function update_event_slug($event_slug) {
35 35
 		return $this->store->update_reaction_event_in_index(
36 36
 			$this->ID
37 37
 			, $event_slug
@@ -41,63 +41,63 @@  discard block
 block discarded – undo
41 41
 	/**
42 42
 	 * @since 2.1.0
43 43
 	 */
44
-	public function get_meta( $key ) {
44
+	public function get_meta($key) {
45 45
 
46 46
 		$settings = $this->get_settings();
47 47
 
48
-		if ( ! is_array( $settings ) || ! isset( $settings[ $key ] ) ) {
48
+		if ( ! is_array($settings) || ! isset($settings[$key])) {
49 49
 			return false;
50 50
 		}
51 51
 
52
-		return $settings[ $key ];
52
+		return $settings[$key];
53 53
 	}
54 54
 
55 55
 	/**
56 56
 	 * @since 2.1.0
57 57
 	 */
58
-	public function add_meta( $key, $value ) {
58
+	public function add_meta($key, $value) {
59 59
 
60 60
 		$settings = $this->get_settings();
61 61
 
62
-		if ( ! is_array( $settings ) || isset( $settings[ $key ] ) ) {
62
+		if ( ! is_array($settings) || isset($settings[$key])) {
63 63
 			return false;
64 64
 		}
65 65
 
66
-		$settings[ $key ] = $value;
66
+		$settings[$key] = $value;
67 67
 
68
-		return $this->update_settings( $settings );
68
+		return $this->update_settings($settings);
69 69
 	}
70 70
 
71 71
 	/**
72 72
 	 * @since 2.1.0
73 73
 	 */
74
-	public function update_meta( $key, $value ) {
74
+	public function update_meta($key, $value) {
75 75
 
76 76
 		$settings = $this->get_settings();
77 77
 
78
-		if ( ! is_array( $settings ) ) {
78
+		if ( ! is_array($settings)) {
79 79
 			return false;
80 80
 		}
81 81
 
82
-		$settings[ $key ] = $value;
82
+		$settings[$key] = $value;
83 83
 
84
-		return $this->update_settings( $settings );
84
+		return $this->update_settings($settings);
85 85
 	}
86 86
 
87 87
 	/**
88 88
 	 * @since 2.1.0
89 89
 	 */
90
-	public function delete_meta( $key ) {
90
+	public function delete_meta($key) {
91 91
 
92 92
 		$settings = $this->get_settings();
93 93
 
94
-		if ( ! is_array( $settings ) || ! isset( $settings[ $key ] ) ) {
94
+		if ( ! is_array($settings) || ! isset($settings[$key])) {
95 95
 			return false;
96 96
 		}
97 97
 
98
-		unset( $settings[ $key ] );
98
+		unset($settings[$key]);
99 99
 
100
-		return $this->update_settings( $settings );
100
+		return $this->update_settings($settings);
101 101
 	}
102 102
 
103 103
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	protected function get_settings() {
118 118
 
119 119
 		return $this->store->get_option(
120
-			$this->store->get_settings_option_name( $this->ID )
120
+			$this->store->get_settings_option_name($this->ID)
121 121
 		);
122 122
 	}
123 123
 
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @return bool Whether the settings were updated successfully.
132 132
 	 */
133
-	protected function update_settings( $settings ) {
133
+	protected function update_settings($settings) {
134 134
 
135 135
 		return $this->store->update_option(
136
-			$this->store->get_settings_option_name( $this->ID )
136
+			$this->store->get_settings_option_name($this->ID)
137 137
 			, $settings
138 138
 		);
139 139
 	}
Please login to merge, or discard this patch.
src/classes/hook/reaction/validator.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 	 * @param bool                            $fail_fast Whether to fail as soon as
104 104
 	 *                                                   the first error is found.
105 105
 	 */
106
-	public function __construct( $settings, $fail_fast = false ) {
106
+	public function __construct($settings, $fail_fast = false) {
107 107
 
108 108
 		$this->fail_fast = $fail_fast;
109 109
 		$this->hooks = wordpoints_hooks();
110 110
 
111
-		if ( $settings instanceof WordPoints_Hook_ReactionI ) {
111
+		if ($settings instanceof WordPoints_Hook_ReactionI) {
112 112
 
113 113
 			$this->reaction     = $settings;
114 114
 			$this->settings     = $this->reaction->get_all_meta();
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 
120 120
 			$this->settings = $settings;
121 121
 
122
-			if ( isset( $this->settings['event'] ) ) {
122
+			if (isset($this->settings['event'])) {
123 123
 				$this->event_slug = $this->settings['event'];
124 124
 			}
125 125
 
126
-			if ( isset( $this->settings['reactor'] ) ) {
126
+			if (isset($this->settings['reactor'])) {
127 127
 				$this->reactor_slug = $this->settings['reactor'];
128 128
 			}
129 129
 		}
@@ -146,40 +146,40 @@  discard block
 block discarded – undo
146 146
 			$fail_fast = $this->fail_fast;
147 147
 			$this->fail_fast = true;
148 148
 
149
-			$events = $this->hooks->get_sub_app( 'events' );
149
+			$events = $this->hooks->get_sub_app('events');
150 150
 
151
-			if ( ! isset( $this->event_slug ) ) {
152
-				$this->add_error( __( 'Event is missing.', 'wordpoints' ), 'event' );
153
-			} elseif ( ! $events->is_registered( $this->event_slug ) ) {
154
-				$this->add_error( __( 'Event is invalid.', 'wordpoints' ), 'event' );
151
+			if ( ! isset($this->event_slug)) {
152
+				$this->add_error(__('Event is missing.', 'wordpoints'), 'event');
153
+			} elseif ( ! $events->is_registered($this->event_slug)) {
154
+				$this->add_error(__('Event is invalid.', 'wordpoints'), 'event');
155 155
 			}
156 156
 
157
-			$reactors = $this->hooks->get_sub_app( 'reactors' );
157
+			$reactors = $this->hooks->get_sub_app('reactors');
158 158
 
159
-			if ( ! isset( $this->reactor_slug ) ) {
160
-				$this->add_error( __( 'Reactor is missing.', 'wordpoints' ), 'reactor' );
161
-			} elseif ( ! $reactors->is_registered( $this->reactor_slug ) ) {
162
-				$this->add_error( __( 'Reactor is invalid.', 'wordpoints' ), 'reactor' );
159
+			if ( ! isset($this->reactor_slug)) {
160
+				$this->add_error(__('Reactor is missing.', 'wordpoints'), 'reactor');
161
+			} elseif ( ! $reactors->is_registered($this->reactor_slug)) {
162
+				$this->add_error(__('Reactor is invalid.', 'wordpoints'), 'reactor');
163 163
 			}
164 164
 
165 165
 			// From here on out we can collect errors as they come (unless we are
166 166
 			// supposed to fail fast).
167 167
 			$this->fail_fast = $fail_fast;
168 168
 
169
-			$event_args = $events->get_sub_app( 'args' )->get_children(
169
+			$event_args = $events->get_sub_app('args')->get_children(
170 170
 				$this->event_slug
171 171
 			);
172 172
 
173
-			$this->event_args = new WordPoints_Hook_Event_Args( $event_args );
174
-			$this->event_args->set_validator( $this );
173
+			$this->event_args = new WordPoints_Hook_Event_Args($event_args);
174
+			$this->event_args->set_validator($this);
175 175
 
176
-			$reactor = $reactors->get( $this->reactor_slug );
176
+			$reactor = $reactors->get($this->reactor_slug);
177 177
 
178
-			$this->settings = $reactor->validate_settings( $this->settings, $this, $this->event_args );
178
+			$this->settings = $reactor->validate_settings($this->settings, $this, $this->event_args);
179 179
 
180 180
 			/** @var WordPoints_Hook_ExtensionI $extension */
181
-			foreach ( $this->hooks->get_sub_app( 'extensions' )->get_all() as $extension ) {
182
-				$this->settings = $extension->validate_settings( $this->settings, $this, $this->event_args );
181
+			foreach ($this->hooks->get_sub_app('extensions')->get_all() as $extension) {
182
+				$this->settings = $extension->validate_settings($this->settings, $this, $this->event_args);
183 183
 			}
184 184
 
185 185
 			/**
@@ -189,12 +189,12 @@  discard block
 block discarded – undo
189 189
 			 * @param WordPoints_Hook_Reaction_Validator $validator The validator object.
190 190
 			 * @param WordPoints_Hook_Event_Args         $args      The event args object.
191 191
 			 */
192
-			$this->settings = apply_filters( 'wordpoints_hook_reaction_validate', $this->settings, $this, $this->event_args );
192
+			$this->settings = apply_filters('wordpoints_hook_reaction_validate', $this->settings, $this, $this->event_args);
193 193
 
194
-		} catch ( WordPoints_Hook_Validator_Exception $e ) {
194
+		} catch (WordPoints_Hook_Validator_Exception $e) {
195 195
 
196 196
 			// Do nothing.
197
-			unset( $e );
197
+			unset($e);
198 198
 
199 199
 		} // End try { validating settings } catch ( validator exception ).
200 200
 
@@ -223,17 +223,17 @@  discard block
 block discarded – undo
223 223
 	 * @throws WordPoints_Hook_Validator_Exception If the validator is configured to
224 224
 	 *                                             fail as soon as an error is found.
225 225
 	 */
226
-	public function add_error( $message, $field = null ) {
226
+	public function add_error($message, $field = null) {
227 227
 
228 228
 		$field_stack = $this->field_stack;
229 229
 
230
-		if ( null !== $field ) {
230
+		if (null !== $field) {
231 231
 			$field_stack[] = $field;
232 232
 		}
233 233
 
234
-		$this->errors[] = array( 'message' => $message, 'field' => $field_stack );
234
+		$this->errors[] = array('message' => $message, 'field' => $field_stack);
235 235
 
236
-		if ( $this->fail_fast ) {
236
+		if ($this->fail_fast) {
237 237
 			throw new WordPoints_Hook_Validator_Exception;
238 238
 		}
239 239
 	}
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * @return bool Whether the validator found any errors.
247 247
 	 */
248 248
 	public function had_errors() {
249
-		return ! empty( $this->errors );
249
+		return ! empty($this->errors);
250 250
 	}
251 251
 
252 252
 	/**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @param string $field The field.
269 269
 	 */
270
-	public function push_field( $field ) {
270
+	public function push_field($field) {
271 271
 		$this->field_stack[] = $field;
272 272
 	}
273 273
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * @since 2.1.0
278 278
 	 */
279 279
 	public function pop_field() {
280
-		array_pop( $this->field_stack );
280
+		array_pop($this->field_stack);
281 281
 	}
282 282
 
283 283
 	/**
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 */
323 323
 	public function get_id() {
324 324
 
325
-		if ( ! $this->reaction ) {
325
+		if ( ! $this->reaction) {
326 326
 			return false;
327 327
 		}
328 328
 
@@ -360,13 +360,13 @@  discard block
 block discarded – undo
360 360
 	 *
361 361
 	 * @return mixed The meta value.
362 362
 	 */
363
-	public function get_meta( $key ) {
363
+	public function get_meta($key) {
364 364
 
365
-		if ( ! isset( $this->settings[ $key ] ) ) {
365
+		if ( ! isset($this->settings[$key])) {
366 366
 			return null;
367 367
 		}
368 368
 
369
-		return $this->settings[ $key ];
369
+		return $this->settings[$key];
370 370
 	}
371 371
 
372 372
 	/**
Please login to merge, or discard this patch.
src/classes/hook/events.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 	/**
36 36
 	 * @since 2.1.0
37 37
 	 */
38
-	public function __construct( $slug ) {
38
+	public function __construct($slug) {
39 39
 
40 40
 		$hooks = wordpoints_hooks();
41 41
 
42
-		$this->router = $hooks->get_sub_app( 'router' );
42
+		$this->router = $hooks->get_sub_app('router');
43 43
 
44
-		parent::__construct( $slug );
44
+		parent::__construct($slug);
45 45
 	}
46 46
 
47 47
 	/**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function init() {
51 51
 
52
-		$this->sub_apps()->register( 'args', 'WordPoints_Class_Registry_Children' );
52
+		$this->sub_apps()->register('args', 'WordPoints_Class_Registry_Children');
53 53
 
54 54
 		parent::init();
55 55
 	}
@@ -73,27 +73,27 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return bool Whether the event was registered.
75 75
 	 */
76
-	public function register( $slug, $class, array $args = array() ) {
76
+	public function register($slug, $class, array $args = array()) {
77 77
 
78
-		parent::register( $slug, $class, $args );
78
+		parent::register($slug, $class, $args);
79 79
 
80
-		if ( isset( $args['actions'] ) ) {
81
-			foreach ( $args['actions'] as $type => $actions ) {
82
-				foreach ( (array) $actions as $action_slug ) {
83
-					$this->router->add_event_to_action( $slug, $action_slug, $type );
80
+		if (isset($args['actions'])) {
81
+			foreach ($args['actions'] as $type => $actions) {
82
+				foreach ((array) $actions as $action_slug) {
83
+					$this->router->add_event_to_action($slug, $action_slug, $type);
84 84
 				}
85 85
 			}
86 86
 		}
87 87
 
88
-		if ( isset( $args['args'] ) ) {
89
-			$args_registry = $this->get_sub_app( 'args' );
88
+		if (isset($args['args'])) {
89
+			$args_registry = $this->get_sub_app('args');
90 90
 
91
-			foreach ( $args['args'] as $arg_slug => $class ) {
92
-				$args_registry->register( $slug, $arg_slug, $class );
91
+			foreach ($args['args'] as $arg_slug => $class) {
92
+				$args_registry->register($slug, $arg_slug, $class);
93 93
 			}
94 94
 		}
95 95
 
96
-		$this->event_data[ $slug ] = $args;
96
+		$this->event_data[$slug] = $args;
97 97
 
98 98
 		return true;
99 99
 	}
@@ -101,23 +101,23 @@  discard block
 block discarded – undo
101 101
 	/**
102 102
 	 * @since 2.1.0
103 103
 	 */
104
-	public function deregister( $slug ) {
104
+	public function deregister($slug) {
105 105
 
106
-		if ( ! $this->is_registered( $slug ) ) {
106
+		if ( ! $this->is_registered($slug)) {
107 107
 			return;
108 108
 		}
109 109
 
110
-		parent::deregister( $slug );
110
+		parent::deregister($slug);
111 111
 
112
-		foreach ( (array) $this->event_data[ $slug ]['actions'] as $type => $actions ) {
113
-			foreach ( (array) $actions as $action_slug ) {
114
-				$this->router->remove_event_from_action( $slug, $action_slug, $type );
112
+		foreach ((array) $this->event_data[$slug]['actions'] as $type => $actions) {
113
+			foreach ((array) $actions as $action_slug) {
114
+				$this->router->remove_event_from_action($slug, $action_slug, $type);
115 115
 			}
116 116
 		}
117 117
 
118
-		$this->get_sub_app( 'args' )->deregister_children( $slug );
118
+		$this->get_sub_app('args')->deregister_children($slug);
119 119
 
120
-		unset( $this->event_data[ $slug ] );
120
+		unset($this->event_data[$slug]);
121 121
 	}
122 122
 }
123 123
 
Please login to merge, or discard this patch.
src/classes/hook/event/media/upload.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function get_title() {
23 23
 
24
-		return __( 'Upload Media', 'wordpoints' );
24
+		return __('Upload Media', 'wordpoints');
25 25
 	}
26 26
 
27 27
 	/**
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function get_description() {
31 31
 
32
-		return __( 'When a file is uploaded to the Media Library.', 'wordpoints' );
32
+		return __('When a file is uploaded to the Media Library.', 'wordpoints');
33 33
 	}
34 34
 
35 35
 	/**
36 36
 	 * @since 2.1.0
37 37
 	 */
38 38
 	public function get_reversal_text() {
39
-		return __( 'Media file deleted.', 'wordpoints' );
39
+		return __('Media file deleted.', 'wordpoints');
40 40
 	}
41 41
 }
42 42
 
Please login to merge, or discard this patch.
src/classes/hook/event/dynamic.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,17 +46,17 @@
 block discarded – undo
46 46
 	 */
47 47
 	protected function get_entity_title() {
48 48
 
49
-		$parts = wordpoints_parse_dynamic_slug( $this->slug );
49
+		$parts = wordpoints_parse_dynamic_slug($this->slug);
50 50
 
51
-		if ( $parts['dynamic'] ) {
51
+		if ($parts['dynamic']) {
52 52
 			$entity_slug = "{$this->generic_entity_slug}\\{$parts['dynamic']}";
53 53
 		} else {
54 54
 			$entity_slug = $this->generic_entity_slug;
55 55
 		}
56 56
 
57
-		$entity = wordpoints_entities()->get( $entity_slug );
57
+		$entity = wordpoints_entities()->get($entity_slug);
58 58
 
59
-		if ( ! $entity instanceof WordPoints_Entity ) {
59
+		if ( ! $entity instanceof WordPoints_Entity) {
60 60
 			return $this->slug;
61 61
 		}
62 62
 
Please login to merge, or discard this patch.