Passed
Push — master ( 156e0e...dfcc60 )
by Paul
04:35
created
plugin/Modules/Style.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@  discard block
 block discarded – undo
47 47
 		}
48 48
 		$views = $this->generatePossibleViews( $view );
49 49
 		foreach( $views as $possibleView ) {
50
-			if( !file_exists( glsr()->path( 'views/'.$possibleView.'.php' )))continue;
50
+			if( !file_exists( glsr()->path( 'views/'.$possibleView.'.php' ))) {
51
+				continue;
52
+			}
51 53
 			return $possibleView;
52 54
 		}
53 55
 		return $view;
@@ -84,7 +86,9 @@  discard block
 block discarded – undo
84 86
 	 */
85 87
 	public function modifyField( Builder $instance )
86 88
 	{
87
-		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return;
89
+		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields ))) {
90
+			return;
91
+		}
88 92
 		call_user_func_array( [$this, 'customize'], [&$instance] );
89 93
 	}
90 94
 
Please login to merge, or discard this patch.
plugin/Modules/Validator.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -93,7 +93,9 @@  discard block
 block discarded – undo
93 93
 		foreach( $this->rules as $attribute => $rules ) {
94 94
 			foreach( $rules as $rule ) {
95 95
 				$this->validateAttribute( $attribute, $rule );
96
-				if( $this->shouldStopValidating( $attribute ))break;
96
+				if( $this->shouldStopValidating( $attribute )) {
97
+					break;
98
+				}
97 99
 			}
98 100
 		}
99 101
 		return $this->errors;
@@ -109,7 +111,9 @@  discard block
 block discarded – undo
109 111
 	public function validateAttribute( $attribute, $rule )
110 112
 	{
111 113
 		list( $rule, $parameters ) = $this->parseRule( $rule );
112
-		if( $rule == '' )return;
114
+		if( $rule == '' ) {
115
+			return;
116
+		}
113 117
 		$value = $this->getValue( $attribute );
114 118
 		if( !method_exists( $this, $method = 'validate'.$rule )) {
115 119
 			throw new BadMethodCallException( "Method [$method] does not exist." );
@@ -178,7 +182,9 @@  discard block
 block discarded – undo
178 182
 	 */
179 183
 	protected function getRule( $attribute, $rules )
180 184
 	{
181
-		if( !array_key_exists( $attribute, $this->rules ))return;
185
+		if( !array_key_exists( $attribute, $this->rules )) {
186
+			return;
187
+		}
182 188
 		$rules = (array)$rules;
183 189
 		foreach( $this->rules[$attribute] as $rule ) {
184 190
 			list( $rule, $parameters ) = $this->parseRule( $rule );
Please login to merge, or discard this patch.
plugin/Handlers/EnqueuePublicAssets.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function enqueuePolyfillService()
57 57
 	{
58
-		if( !apply_filters( 'site-reviews/assets/polyfill', true ))return;
58
+		if( !apply_filters( 'site-reviews/assets/polyfill', true )) {
59
+			return;
60
+		}
59 61
 		wp_enqueue_script( Application::ID.'/polyfill', add_query_arg([
60 62
 			'features' => 'CustomEvent,Element.prototype.closest,Element.prototype.dataset,Event',
61 63
 			'flags' => 'gated',
@@ -70,7 +72,9 @@  discard block
 block discarded – undo
70 72
 		// wpforms-recaptcha
71 73
 		// google-recaptcha
72 74
 		// nf-google-recaptcha
73
-		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
75
+		if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) {
76
+			return;
77
+		}
74 78
 		$language = apply_filters( 'site-reviews/recaptcha/language', get_locale() );
75 79
 		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([
76 80
 			'hl' => $language,
@@ -84,7 +88,9 @@  discard block
 block discarded – undo
84 88
 	public function inlineStyles()
85 89
 	{
86 90
 		$inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' );
87
-		if( !apply_filters( 'site-reviews/assets/css', true ))return;
91
+		if( !apply_filters( 'site-reviews/assets/css', true )) {
92
+			return;
93
+		}
88 94
 		if( !file_exists( $inlineStylesheetPath )) {
89 95
 			glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath );
90 96
 			return;
Please login to merge, or discard this patch.
plugin/Defaults/DefaultsAbstract.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@
 block discarded – undo
13 13
 	 */
14 14
 	public function __call( $name, array $args = [] )
15 15
 	{
16
-		if( !method_exists( $this, $name ))return;
16
+		if( !method_exists( $this, $name )) {
17
+			return;
18
+		}
17 19
 		$defaults = call_user_func_array( [$this, $name], $args );
18 20
 		$className = (new ReflectionClass( $this ))->getShortName();
19 21
 		$className = str_replace( 'Defaults', '', $className );
Please login to merge, or discard this patch.
plugin/Modules/Validator/ValidateReview.php 1 patch
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -166,8 +166,12 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	protected function validateAkismet()
168 168
 	{
169
-		if( !empty( $this->error ))return;
170
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
169
+		if( !empty( $this->error )) {
170
+			return;
171
+		}
172
+		if( !glsr( Akismet::class )->isSpam( $this->request )) {
173
+			return;
174
+		}
171 175
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' );
172 176
 		$this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' );
173 177
 	}
@@ -177,8 +181,12 @@  discard block
 block discarded – undo
177 181
 	 */
178 182
 	protected function validateBlacklist()
179 183
 	{
180
-		if( !empty( $this->error ))return;
181
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
184
+		if( !empty( $this->error )) {
185
+			return;
186
+		}
187
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) {
188
+			return;
189
+		}
182 190
 		$blacklistAction = $this->getOption( 'settings.submissions.blacklist.action' );
183 191
 		if( $blacklistAction == 'reject' ) {
184 192
 			$this->setSessionValues( 'errors', [], 'Blacklisted submission detected:' );
@@ -193,9 +201,13 @@  discard block
 block discarded – undo
193 201
 	 */
194 202
 	protected function validateCustom()
195 203
 	{
196
-		if( !empty( $this->error ))return;
204
+		if( !empty( $this->error )) {
205
+			return;
206
+		}
197 207
 		$validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request );
198
-		if( $validated === true )return;
208
+		if( $validated === true ) {
209
+			return;
210
+		}
199 211
 		$this->setSessionValues( 'errors', [] );
200 212
 		$this->setSessionValues( 'values', $this->request );
201 213
 		$this->error = is_string( $validated )
@@ -208,8 +220,12 @@  discard block
 block discarded – undo
208 220
 	 */
209 221
 	protected function validateHoneyPot()
210 222
 	{
211
-		if( !empty( $this->error ))return;
212
-		if( empty( $this->request['gotcha'] ))return;
223
+		if( !empty( $this->error )) {
224
+			return;
225
+		}
226
+		if( empty( $this->request['gotcha'] )) {
227
+			return;
228
+		}
213 229
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
214 230
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
215 231
 	}
@@ -219,7 +235,9 @@  discard block
 block discarded – undo
219 235
 	 */
220 236
 	protected function validateRecaptcha()
221 237
 	{
222
-		if( !empty( $this->error ))return;
238
+		if( !empty( $this->error )) {
239
+			return;
240
+		}
223 241
 		$isValid = $this->isRecaptchaResponseValid();
224 242
 		if( is_null( $isValid )) {
225 243
 			$this->setSessionValues( 'recaptcha', 'unset' );
Please login to merge, or discard this patch.
plugin/Router.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@  discard block
 block discarded – undo
17 17
 	public function routeAdminPostRequest()
18 18
 	{
19 19
 		$request = $this->getRequest();
20
-		if( !$this->isValidPostRequest( $request ))return;
20
+		if( !$this->isValidPostRequest( $request )) {
21
+			return;
22
+		}
21 23
 		check_admin_referer( $request['action'] );
22 24
 		$this->routeRequest( 'admin', $request['action'], $request );
23 25
 	}
@@ -39,10 +41,16 @@  discard block
 block discarded – undo
39 41
 	 */
40 42
 	public function routePublicPostRequest()
41 43
 	{
42
-		if( is_admin() )return;
44
+		if( is_admin() ) {
45
+			return;
46
+		}
43 47
 		$request = $this->getRequest();
44
-		if( !$this->isValidPostRequest( $request ))return;
45
-		if( !$this->isValidPublicNonce( $request ))return;
48
+		if( !$this->isValidPostRequest( $request )) {
49
+			return;
50
+		}
51
+		if( !$this->isValidPublicNonce( $request )) {
52
+			return;
53
+		}
46 54
 		$this->routeRequest( 'public', $request['action'], $request );
47 55
 	}
48 56
 
@@ -51,7 +59,9 @@  discard block
 block discarded – undo
51 59
 	 */
52 60
 	protected function checkAjaxNonce( array $request )
53 61
 	{
54
-		if( !is_user_logged_in() )return;
62
+		if( !is_user_logged_in() ) {
63
+			return;
64
+		}
55 65
 		if( !isset( $request['nonce'] )) {
56 66
 			$this->sendAjaxError( 'request is missing a nonce', $request );
57 67
 		}
Please login to merge, or discard this patch.
plugin/Handlers/CreateReview.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 		glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ));
24 24
 		glsr( Notification::class )->send( $review );
25 25
 		do_action( 'site-reviews/local/review/submitted', $review );
26
-		if( $command->ajax_request )return;
26
+		if( $command->ajax_request ) {
27
+			return;
28
+		}
27 29
 		if( empty( $command->referer )) {
28 30
 			glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command );
29 31
 			$command->referer = home_url();
Please login to merge, or discard this patch.
plugin/Modules/Slack.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@
 block discarded – undo
35 35
 	 */
36 36
 	public function compose( Review $review, array $notification )
37 37
 	{
38
-		if( empty( $this->endpoint ))return;
38
+		if( empty( $this->endpoint )) {
39
+			return;
40
+		}
39 41
 		$args = shortcode_atts( glsr( SlackDefaults::class )->defaults(), $notification );
40 42
 		$this->review = $review;
41 43
 		$notification = [
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviewsForm.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,7 +85,9 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	protected function buildRecaptcha()
87 87
 	{
88
-		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
88
+		if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) {
89
+			return;
90
+		}
89 91
 		return glsr( Builder::class )->div([
90 92
 			'class' => 'glsr-recaptcha-holder',
91 93
 			'data-badge' => glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ),
@@ -161,7 +163,9 @@  discard block
 block discarded – undo
161 163
 	 */
162 164
 	protected function getRegisterText()
163 165
 	{
164
-		if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' )return;
166
+		if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' ) {
167
+			return;
168
+		}
165 169
 		$registerLink = glsr( Builder::class )->a([
166 170
 			'href' => wp_registration_url(),
167 171
 			'text' => __( 'register', 'site-reviews' ),
@@ -217,7 +221,9 @@  discard block
 block discarded – undo
217 221
 	 */
218 222
 	protected function normalizeFieldErrors( Field &$field )
219 223
 	{
220
-		if( !array_key_exists( $field->field['path'], $this->errors ))return;
224
+		if( !array_key_exists( $field->field['path'], $this->errors )) {
225
+			return;
226
+		}
221 227
 		$field->field['errors'] = $this->errors[$field->field['path']];
222 228
 	}
223 229
 
@@ -226,7 +232,9 @@  discard block
 block discarded – undo
226 232
 	 */
227 233
 	protected function normalizeFieldRequired( Field &$field )
228 234
 	{
229
-		if( !in_array( $field->field['path'], $this->required ))return;
235
+		if( !in_array( $field->field['path'], $this->required )) {
236
+			return;
237
+		}
230 238
 		$field->field['required'] = true;
231 239
 	}
232 240
 
@@ -249,7 +257,9 @@  discard block
 block discarded – undo
249 257
 	 */
250 258
 	protected function normalizeFieldValue( Field &$field )
251 259
 	{
252
-		if( !array_key_exists( $field->field['path'], $this->values ))return;
260
+		if( !array_key_exists( $field->field['path'], $this->values )) {
261
+			return;
262
+		}
253 263
 		if( in_array( $field->field['type'], ['radio', 'checkbox'] )) {
254 264
 			$field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']];
255 265
 		}
Please login to merge, or discard this patch.