Completed
Push — master ( a97d75...975fd1 )
by J.D.
03:39
created
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/extension/conditions.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
 
45 45
 		$conditions_data = array();
46 46
 
47
-		foreach ( $this->conditions->get_all() as $data_type => $conditions ) {
48
-			foreach ( $conditions as $slug => $condition ) {
47
+		foreach ($this->conditions->get_all() as $data_type => $conditions) {
48
+			foreach ($conditions as $slug => $condition) {
49 49
 
50
-				if ( ! ( $condition instanceof WordPoints_Hook_ConditionI ) ) {
50
+				if ( ! ($condition instanceof WordPoints_Hook_ConditionI)) {
51 51
 					continue;
52 52
 				}
53 53
 
54
-				$conditions_data[ $data_type ][ $slug ] = array(
54
+				$conditions_data[$data_type][$slug] = array(
55 55
 					'slug'      => $slug,
56 56
 					'data_type' => $data_type,
57 57
 					'title'     => $condition->get_title(),
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 			}
61 61
 		}
62 62
 
63
-		return array( 'conditions' => $conditions_data );
63
+		return array('conditions' => $conditions_data);
64 64
 	}
65 65
 
66 66
 	/**
67 67
 	 * @since 1.0.0
68 68
 	 */
69
-	protected function validate_action_type_settings( $settings ) {
70
-		return $this->validate_conditions( $settings );
69
+	protected function validate_action_type_settings($settings) {
70
+		return $this->validate_conditions($settings);
71 71
 	}
72 72
 
73 73
 	/**
@@ -80,36 +80,36 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return array The validated settings.
82 82
 	 */
83
-	public function validate_conditions( $conditions, WordPoints_Hook_Event_Args $event_args = null ) {
83
+	public function validate_conditions($conditions, WordPoints_Hook_Event_Args $event_args = null) {
84 84
 
85
-		if ( $event_args ) {
85
+		if ($event_args) {
86 86
 			$this->event_args = $event_args;
87 87
 			$this->validator = $event_args->get_validator();
88 88
 		}
89 89
 
90
-		if ( ! is_array( $conditions ) ) {
90
+		if ( ! is_array($conditions)) {
91 91
 
92 92
 			$this->validator->add_error(
93
-				__( 'Conditions do not match expected format.', 'wordpoints' )
93
+				__('Conditions do not match expected format.', 'wordpoints')
94 94
 			);
95 95
 
96 96
 			return array();
97 97
 		}
98 98
 
99
-		foreach ( $conditions as $arg_slug => $sub_args ) {
99
+		foreach ($conditions as $arg_slug => $sub_args) {
100 100
 
101
-			if ( '_conditions' === $arg_slug ) {
101
+			if ('_conditions' === $arg_slug) {
102 102
 
103
-				$this->validator->push_field( $arg_slug );
103
+				$this->validator->push_field($arg_slug);
104 104
 
105
-				foreach ( $sub_args as $index => $settings ) {
105
+				foreach ($sub_args as $index => $settings) {
106 106
 
107
-					$this->validator->push_field( $index );
107
+					$this->validator->push_field($index);
108 108
 
109
-					$condition = $this->validate_condition( $settings );
109
+					$condition = $this->validate_condition($settings);
110 110
 
111
-					if ( $condition ) {
112
-						$sub_args[ $index ] = $condition;
111
+					if ($condition) {
112
+						$sub_args[$index] = $condition;
113 113
 					}
114 114
 
115 115
 					$this->validator->pop_field();
@@ -119,18 +119,18 @@  discard block
 block discarded – undo
119 119
 
120 120
 			} else {
121 121
 
122
-				if ( ! $this->event_args->descend( $arg_slug ) ) {
122
+				if ( ! $this->event_args->descend($arg_slug)) {
123 123
 					continue;
124 124
 				}
125 125
 
126
-				$sub_args = $this->validate_action_type_settings( $sub_args );
126
+				$sub_args = $this->validate_action_type_settings($sub_args);
127 127
 
128
-				$conditions[ $arg_slug ] = $sub_args;
128
+				$conditions[$arg_slug] = $sub_args;
129 129
 
130 130
 				$this->event_args->ascend();
131 131
 			}
132 132
 
133
-			$conditions[ $arg_slug ] = $sub_args;
133
+			$conditions[$arg_slug] = $sub_args;
134 134
 		}
135 135
 
136 136
 		return $conditions;
@@ -146,32 +146,32 @@  discard block
 block discarded – undo
146 146
 	 * @return array|false The validated conditions settings, or false if unable to
147 147
 	 *                     validate.
148 148
 	 */
149
-	protected function validate_condition( $settings ) {
149
+	protected function validate_condition($settings) {
150 150
 
151
-		if ( ! isset( $settings['type'] ) ) {
152
-			$this->validator->add_error( __( 'Condition type is missing.', 'wordpoints' ) );
151
+		if ( ! isset($settings['type'])) {
152
+			$this->validator->add_error(__('Condition type is missing.', 'wordpoints'));
153 153
 			return false;
154 154
 		}
155 155
 
156 156
 		$arg = $this->event_args->get_current();
157 157
 
158
-		$data_type = $this->get_data_type( $arg );
158
+		$data_type = $this->get_data_type($arg);
159 159
 
160
-		if ( ! $data_type ) {
160
+		if ( ! $data_type) {
161 161
 			$this->validator->add_error(
162
-				__( 'This type of condition does not work for the selected attribute.', 'wordpoints' )
162
+				__('This type of condition does not work for the selected attribute.', 'wordpoints')
163 163
 			);
164 164
 
165 165
 			return false;
166 166
 		}
167 167
 
168
-		$condition = wordpoints_hooks()->conditions->get( $data_type, $settings['type'] );
168
+		$condition = wordpoints_hooks()->conditions->get($data_type, $settings['type']);
169 169
 
170
-		if ( ! $condition ) {
170
+		if ( ! $condition) {
171 171
 
172 172
 			$this->validator->add_error(
173 173
 				sprintf(
174
-					__( 'Unknown condition type “%s”.', 'wordpoints' )
174
+					__('Unknown condition type “%s”.', 'wordpoints')
175 175
 					, $settings['type']
176 176
 				)
177 177
 				, 'type'
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
 			return false;
181 181
 		}
182 182
 
183
-		if ( ! isset( $settings['settings'] ) ) {
184
-			$this->validator->add_error( __( 'Condition settings are missing.', 'wordpoints' ) );
183
+		if ( ! isset($settings['settings'])) {
184
+			$this->validator->add_error(__('Condition settings are missing.', 'wordpoints'));
185 185
 			return false;
186 186
 		}
187 187
 
188
-		$this->validator->push_field( 'settings' );
188
+		$this->validator->push_field('settings');
189 189
 
190 190
 		// The condition may call this object's validate_settings() method to
191 191
 		// validate some sub-conditions. When that happens, these properties will be
192 192
 		// reset, so we need to back up their values and then restore them below.
193
-		$backup = array( $this->validator, $this->event_args );
193
+		$backup = array($this->validator, $this->event_args);
194 194
 
195 195
 		$settings['settings'] = $condition->validate_settings(
196 196
 			$arg
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 			, $this->validator
199 199
 		);
200 200
 
201
-		list( $this->validator, $this->event_args ) = $backup;
201
+		list($this->validator, $this->event_args) = $backup;
202 202
 
203 203
 		$this->validator->pop_field();
204 204
 
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 	/**
209 209
 	 * @since 1.0.0
210 210
 	 */
211
-	public function should_hit( WordPoints_Hook_Fire $fire ) {
211
+	public function should_hit(WordPoints_Hook_Fire $fire) {
212 212
 
213
-		$conditions = $this->get_settings_from_fire( $fire );
213
+		$conditions = $this->get_settings_from_fire($fire);
214 214
 
215
-		if ( $conditions && ! $this->conditions_are_met( $conditions, $fire->event_args ) ) {
215
+		if ($conditions && ! $this->conditions_are_met($conditions, $fire->event_args)) {
216 216
 			return false;
217 217
 		}
218 218
 
@@ -234,35 +234,35 @@  discard block
 block discarded – undo
234 234
 		WordPoints_Hook_Event_Args $event_args
235 235
 	) {
236 236
 
237
-		foreach ( $conditions as $arg_slug => $sub_args ) {
237
+		foreach ($conditions as $arg_slug => $sub_args) {
238 238
 
239
-			$event_args->descend( $arg_slug );
239
+			$event_args->descend($arg_slug);
240 240
 
241
-			if ( isset( $sub_args['_conditions'] ) ) {
241
+			if (isset($sub_args['_conditions'])) {
242 242
 
243
-				foreach ( $sub_args['_conditions'] as $settings ) {
243
+				foreach ($sub_args['_conditions'] as $settings) {
244 244
 
245 245
 					$condition = $this->conditions->get(
246
-						$this->get_data_type( $event_args->get_current() )
246
+						$this->get_data_type($event_args->get_current())
247 247
 						, $settings['type']
248 248
 					);
249 249
 
250
-					$is_met = $condition->is_met( $settings['settings'], $event_args );
250
+					$is_met = $condition->is_met($settings['settings'], $event_args);
251 251
 
252
-					if ( ! $is_met ) {
252
+					if ( ! $is_met) {
253 253
 						$event_args->ascend();
254 254
 						return false;
255 255
 					}
256 256
 				}
257 257
 
258
-				unset( $sub_args['_conditions'] );
258
+				unset($sub_args['_conditions']);
259 259
 			}
260 260
 
261
-			$are_met = $this->conditions_are_met( $sub_args, $event_args );
261
+			$are_met = $this->conditions_are_met($sub_args, $event_args);
262 262
 
263 263
 			$event_args->ascend();
264 264
 
265
-			if ( ! $are_met ) {
265
+			if ( ! $are_met) {
266 266
 				return false;
267 267
 			}
268 268
 		}
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
 	 *
280 280
 	 * @return string|false The data type, or false.
281 281
 	 */
282
-	protected function get_data_type( $arg ) {
282
+	protected function get_data_type($arg) {
283 283
 
284
-		if ( $arg instanceof WordPoints_Entity_Attr ) {
284
+		if ($arg instanceof WordPoints_Entity_Attr) {
285 285
 			$data_type = $arg->get_data_type();
286
-		} elseif ( $arg instanceof WordPoints_Entity_Array ) {
286
+		} elseif ($arg instanceof WordPoints_Entity_Array) {
287 287
 			$data_type = 'entity_array';
288
-		} elseif ( $arg instanceof WordPoints_Entity ) {
288
+		} elseif ($arg instanceof WordPoints_Entity) {
289 289
 			$data_type = 'entity';
290 290
 		} else {
291 291
 			$data_type = false;
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.
src/includes/classes/hook/reactor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -111,21 +111,21 @@  discard block
 block discarded – undo
111 111
 	) {
112 112
 
113 113
 		if (
114
-			empty( $settings['target'] )
115
-			|| ! is_array( $settings['target'] )
114
+			empty($settings['target'])
115
+			|| ! is_array($settings['target'])
116 116
 		) {
117 117
 
118
-			$validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' );
118
+			$validator->add_error(__('Invalid target.', 'wordpoints'), 'target');
119 119
 
120 120
 		} else {
121 121
 
122
-			$target = $event_args->get_from_hierarchy( $settings['target'] );
122
+			$target = $event_args->get_from_hierarchy($settings['target']);
123 123
 
124 124
 			if (
125 125
 				! $target instanceof WordPoints_Entity
126
-				|| ! in_array( $target->get_slug(), (array) $this->arg_types )
126
+				|| ! in_array($target->get_slug(), (array) $this->arg_types)
127 127
 			) {
128
-				$validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' );
128
+				$validator->add_error(__('Invalid target.', 'wordpoints'), 'target');
129 129
 			}
130 130
 		}
131 131
 
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 	/**
136 136
 	 * @since 1.0.0
137 137
 	 */
138
-	public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) {
139
-		$reaction->update_meta( 'target', $settings['target'] );
138
+	public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) {
139
+		$reaction->update_meta('target', $settings['target']);
140 140
 	}
141 141
 }
142 142
 
Please login to merge, or discard this patch.
src/includes/classes/hook/reactioni.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @return bool Whether the event was updated successfully.
59 59
 	 */
60
-	public function update_event_slug( $event_slug );
60
+	public function update_event_slug($event_slug);
61 61
 
62 62
 	/**
63 63
 	 * Get the slug of the reactor this reaction is for.
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return mixed|false The meta value, or false if not found.
92 92
 	 */
93
-	public function get_meta( $key );
93
+	public function get_meta($key);
94 94
 
95 95
 	/**
96 96
 	 * Add a piece of metadata for this reaction.
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return bool Whether the metadata was added successfully.
106 106
 	 */
107
-	public function add_meta( $key, $value );
107
+	public function add_meta($key, $value);
108 108
 
109 109
 	/**
110 110
 	 * Update a piece of metadata for this reaction.
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return bool Whether the metadata was updated successfully.
118 118
 	 */
119
-	public function update_meta( $key, $value );
119
+	public function update_meta($key, $value);
120 120
 
121 121
 	/**
122 122
 	 * Delete a piece of metadata for this reaction.
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 *
128 128
 	 * @return bool Whether the metadata was deleted successfully.
129 129
 	 */
130
-	public function delete_meta( $key );
130
+	public function delete_meta($key);
131 131
 
132 132
 	/**
133 133
 	 * Get all of the metadata for this reaction.
Please login to merge, or discard this patch.