Completed
Push — master ( 5b2818...3f335f )
by J.D.
03:35
created
src/includes/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 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,52 +162,52 @@  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
-		$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
 
319 319
 		$current_mode = wordpoints_hooks()->get_current_mode();
320 320
 
Please login to merge, or discard this patch.
src/includes/classes/hook/condition/string/contains.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @since 1.0.0
19 19
 	 */
20 20
 	public function get_title() {
21
-		return __( 'Contains', 'wordpoints' );
21
+		return __('Contains', 'wordpoints');
22 22
 	}
23 23
 
24 24
 	/**
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		return array(
29 29
 			'value' => array(
30 30
 				'type'     => 'text',
31
-				'label'    => __( 'Word or phrase (case sensitive)', 'wordpoints' ),
31
+				'label'    => __('Word or phrase (case sensitive)', 'wordpoints'),
32 32
 				'required' => true,
33 33
 			),
34 34
 		);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @since 1.0.0
39 39
 	 */
40
-	public function is_met( array $settings, WordPoints_Hook_Event_Args $args ) {
40
+	public function is_met(array $settings, WordPoints_Hook_Event_Args $args) {
41 41
 
42 42
 		return false !== strpos(
43 43
 			$args->get_current()->get_the_value()
Please login to merge, or discard this patch.
src/includes/classes/entity/user/role/name.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 * @since 1.0.0
34 34
 	 */
35 35
 	public function get_title() {
36
-		return _x( 'Name', 'user role', 'wordpoints' );
36
+		return _x('Name', 'user role', 'wordpoints');
37 37
 	}
38 38
 }
39 39
 
Please login to merge, or discard this patch.
src/includes/classes/entity/term/id.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 * @since 1.0.0
34 34
 	 */
35 35
 	public function get_title() {
36
-		return _x( 'ID', 'taxonomy term', 'wordpoints' );
36
+		return _x('ID', 'taxonomy term', 'wordpoints');
37 37
 	}
38 38
 }
39 39
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/extension.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 		WordPoints_Hook_Event_Args $event_args
58 58
 	) {
59 59
 
60
-		if ( ! isset( $settings[ $this->slug ] ) ) {
60
+		if ( ! isset($settings[$this->slug])) {
61 61
 			return $settings;
62 62
 		}
63 63
 
64
-		if ( ! is_array( $settings[ $this->slug ] ) ) {
64
+		if ( ! is_array($settings[$this->slug])) {
65 65
 
66 66
 			$validator->add_error(
67
-				__( 'Invalid settings format.', 'wordpoints' )
67
+				__('Invalid settings format.', 'wordpoints')
68 68
 				, $this->slug
69 69
 			);
70 70
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 		$this->validator = $validator;
75 75
 		$this->event_args = $event_args;
76 76
 
77
-		$this->validator->push_field( $this->slug );
77
+		$this->validator->push_field($this->slug);
78 78
 
79
-		foreach ( $settings[ $this->slug ] as $action_type => $action_type_settings ) {
79
+		foreach ($settings[$this->slug] as $action_type => $action_type_settings) {
80 80
 
81
-			$this->validator->push_field( $action_type );
81
+			$this->validator->push_field($action_type);
82 82
 
83
-			$settings[ $this->slug ][ $action_type ] = $this->validate_action_type_settings(
83
+			$settings[$this->slug][$action_type] = $this->validate_action_type_settings(
84 84
 				$action_type_settings
85 85
 			);
86 86
 
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 	/**
96 96
 	 * @since 1.0.0
97 97
 	 */
98
-	public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) {
98
+	public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) {
99 99
 
100
-		if ( isset( $settings[ $this->slug ] ) ) {
101
-			$reaction->update_meta( $this->slug, $settings[ $this->slug ] );
100
+		if (isset($settings[$this->slug])) {
101
+			$reaction->update_meta($this->slug, $settings[$this->slug]);
102 102
 		} else {
103
-			$reaction->delete_meta( $this->slug );
103
+			$reaction->delete_meta($this->slug);
104 104
 		}
105 105
 	}
106 106
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return mixed The validated settings.
115 115
 	 */
116
-	protected function validate_action_type_settings( $settings ) {
116
+	protected function validate_action_type_settings($settings) {
117 117
 		return $settings;
118 118
 	}
119 119
 
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @return mixed The settings for the extension, or false if none.
132 132
 	 */
133
-	protected function get_settings_from_fire( WordPoints_Hook_Fire $fire ) {
133
+	protected function get_settings_from_fire(WordPoints_Hook_Fire $fire) {
134 134
 
135
-		$settings = $fire->reaction->get_meta( $this->slug );
135
+		$settings = $fire->reaction->get_meta($this->slug);
136 136
 
137
-		if ( ! is_array( $settings ) ) {
137
+		if ( ! is_array($settings)) {
138 138
 			return $settings;
139 139
 		}
140 140
 
141
-		if ( isset( $settings[ $fire->action_type ] ) ) {
142
-			return $settings[ $fire->action_type ];
141
+		if (isset($settings[$fire->action_type])) {
142
+			return $settings[$fire->action_type];
143 143
 		} else {
144 144
 			return false;
145 145
 		}
Please login to merge, or discard this patch.
src/includes/classes/hook/actioni.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 *
51 51
 	 * @return mixed The arg value.
52 52
 	 */
53
-	public function get_arg_value( $arg_slug );
53
+	public function get_arg_value($arg_slug);
54 54
 }
55 55
 
56 56
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/extensioni.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 	 *
37 37
 	 * @return bool Whether the target should be hit by this hook firing.
38 38
 	 */
39
-	public function should_hit( WordPoints_Hook_Fire $fire );
39
+	public function should_hit(WordPoints_Hook_Fire $fire);
40 40
 }
41 41
 
42 42
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/reactori.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
 	 *
77 77
 	 * @param WordPoints_Hook_Fire $fire The hook fire object.
78 78
 	 */
79
-	public function hit( WordPoints_Hook_Fire $fire );
79
+	public function hit(WordPoints_Hook_Fire $fire);
80 80
 }
81 81
 
82 82
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/storei.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return bool Whether the reaction exists.
52 52
 	 */
53
-	public function reaction_exists( $id );
53
+	public function reaction_exists($id);
54 54
 
55 55
 	/**
56 56
 	 * Get an reaction object.
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 *
62 62
 	 * @return WordPoints_Hook_ReactionI|false The reaction, or false if nonexistent.
63 63
 	 */
64
-	public function get_reaction( $id );
64
+	public function get_reaction($id);
65 65
 
66 66
 	/**
67 67
 	 * Create an reaction.
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *         The reaction object if created successfully. False or a validator
75 75
 	 *         instance if not.
76 76
 	 */
77
-	public function create_reaction( array $settings );
77
+	public function create_reaction(array $settings);
78 78
 
79 79
 	/**
80 80
 	 * Update an reaction.
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 *         The reaction object if updated successfully. False or a validator
89 89
 	 *         instance if not.
90 90
 	 */
91
-	public function update_reaction( $id, array $settings );
91
+	public function update_reaction($id, array $settings);
92 92
 
93 93
 	/**
94 94
 	 * Delete an reaction.
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @return bool Whether the reaction was deleted successfully.
101 101
 	 */
102
-	public function delete_reaction( $id );
102
+	public function delete_reaction($id);
103 103
 
104 104
 	/**
105 105
 	 * Get all hook reactions for the reactor.
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @return WordPoints_Hook_ReactionI[]
124 124
 	 */
125
-	public function get_reactions_to_event( $event_slug );
125
+	public function get_reactions_to_event($event_slug);
126 126
 }
127 127
 
128 128
 // EOF
Please login to merge, or discard this patch.