Passed
Push — master ( 60ab10...dc3967 )
by Paul
05:02
created
plugin/Modules/Validator/ValidateReview.php 1 patch
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -171,8 +171,12 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	protected function validateAkismet()
173 173
 	{
174
-		if( !empty( $this->error ))return;
175
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
174
+		if( !empty( $this->error )) {
175
+			return;
176
+		}
177
+		if( !glsr( Akismet::class )->isSpam( $this->request )) {
178
+			return;
179
+		}
176 180
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' );
177 181
 		$this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' );
178 182
 	}
@@ -182,8 +186,12 @@  discard block
 block discarded – undo
182 186
 	 */
183 187
 	protected function validateBlacklist()
184 188
 	{
185
-		if( !empty( $this->error ))return;
186
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
189
+		if( !empty( $this->error )) {
190
+			return;
191
+		}
192
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) {
193
+			return;
194
+		}
187 195
 		$blacklistAction = glsr( OptionManager::class )->get( 'settings.submissions.blacklist.action' );
188 196
 		if( $blacklistAction == 'unapprove' ) {
189 197
 			$this->request['blacklisted'] = true;
@@ -199,9 +207,13 @@  discard block
 block discarded – undo
199 207
 	 */
200 208
 	protected function validateCustom()
201 209
 	{
202
-		if( !empty( $this->error ))return;
210
+		if( !empty( $this->error )) {
211
+			return;
212
+		}
203 213
 		$validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request );
204
-		if( $validated === true )return;
214
+		if( $validated === true ) {
215
+			return;
216
+		}
205 217
 		$this->setSessionValues( 'errors', [] );
206 218
 		$this->setSessionValues( 'values', $this->request );
207 219
 		$this->error = is_string( $validated )
@@ -214,8 +226,12 @@  discard block
 block discarded – undo
214 226
 	 */
215 227
 	protected function validateHoneyPot()
216 228
 	{
217
-		if( !empty( $this->error ))return;
218
-		if( empty( $this->request['gotcha'] ))return;
229
+		if( !empty( $this->error )) {
230
+			return;
231
+		}
232
+		if( empty( $this->request['gotcha'] )) {
233
+			return;
234
+		}
219 235
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
220 236
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
221 237
 	}
@@ -225,7 +241,9 @@  discard block
 block discarded – undo
225 241
 	 */
226 242
 	protected function validateRecaptcha()
227 243
 	{
228
-		if( !empty( $this->error ))return;
244
+		if( !empty( $this->error )) {
245
+			return;
246
+		}
229 247
 		$isValid = $this->isRecaptchaResponseValid();
230 248
 		if( is_null( $isValid )) {
231 249
 			$this->setSessionValues( 'recaptcha', true );
Please login to merge, or discard this patch.