Passed
Push — master ( 9e5b16...6a4033 )
by Paul
04:16
created
plugin/Modules/Html/Partials/SiteReviewsForm.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -152,7 +152,9 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	protected function normalizeFieldErrors( Field &$field )
154 154
 	{
155
-		if( !array_key_exists( $field->field['path'], $this->errors ))return;
155
+		if( !array_key_exists( $field->field['path'], $this->errors )) {
156
+			return;
157
+		}
156 158
 		$field->field['errors'] = $this->errors[$field->field['path']];
157 159
 	}
158 160
 
@@ -161,7 +163,9 @@  discard block
 block discarded – undo
161 163
 	 */
162 164
 	protected function normalizeFieldRequired( Field &$field )
163 165
 	{
164
-		if( !in_array( $field->field['path'], $this->required ))return;
166
+		if( !in_array( $field->field['path'], $this->required )) {
167
+			return;
168
+		}
165 169
 		$field->field['required'] = true;
166 170
 	}
167 171
 
@@ -183,7 +187,9 @@  discard block
 block discarded – undo
183 187
 	 */
184 188
 	protected function normalizeFieldValue( Field &$field )
185 189
 	{
186
-		if( !array_key_exists( $field->field['path'], $this->values ))return;
190
+		if( !array_key_exists( $field->field['path'], $this->values )) {
191
+			return;
192
+		}
187 193
 		if( in_array( $field->field['type'], ['radio', 'checkbox'] )) {
188 194
 			$field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']];
189 195
 		}
Please login to merge, or discard this patch.
plugin/Modules/Html/Field.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function build()
45 45
 	{
46
-		if( !$this->field['is_valid'] )return;
46
+		if( !$this->field['is_valid'] ) {
47
+			return;
48
+		}
47 49
 		if( $this->field['is_raw'] ) {
48 50
 			return glsr( Builder::class )->{$this->field['type']}( $this->field );
49 51
 		}
@@ -143,7 +145,9 @@  discard block
 block discarded – undo
143 145
 	 */
144 146
 	protected function getFieldErrors()
145 147
 	{
146
-		if( empty( $this->field['errors'] ) || !is_array( $this->field['errors'] ))return;
148
+		if( empty( $this->field['errors'] ) || !is_array( $this->field['errors'] )) {
149
+			return;
150
+		}
147 151
 		$errors = array_reduce( $this->field['errors'], function( $carry, $error ) {
148 152
 			return $carry.glsr( Builder::class )->span( $error, ['class' => 'glsr-field-error'] );
149 153
 		});
@@ -170,7 +174,9 @@  discard block
 block discarded – undo
170 174
 			'name', 'type',
171 175
 		];
172 176
 		foreach( $requiredValues as $value ) {
173
-			if( isset( $this->field[$value] ))continue;
177
+			if( isset( $this->field[$value] )) {
178
+				continue;
179
+			}
174 180
 			$missingValues[] = $value;
175 181
 			$this->field['is_valid'] = false;
176 182
 		}
@@ -187,7 +193,9 @@  discard block
 block discarded – undo
187 193
 	 */
188 194
 	protected function normalize()
189 195
 	{
190
-		if( !$this->isFieldValid() )return;
196
+		if( !$this->isFieldValid() ) {
197
+			return;
198
+		}
191 199
 		$this->field['path'] = $this->field['name'];
192 200
 		$className = glsr( Helper::class )->buildClassName( $this->field['type'], __NAMESPACE__.'\Fields' );
193 201
 		if( class_exists( $className )) {
@@ -205,7 +213,9 @@  discard block
 block discarded – undo
205 213
 	 */
206 214
 	protected function normalizeFieldId()
207 215
 	{
208
-		if( isset( $this->field['id'] ) || $this->field['is_raw'] )return;
216
+		if( isset( $this->field['id'] ) || $this->field['is_raw'] ) {
217
+			return;
218
+		}
209 219
 		$this->field['id'] = glsr( Helper::class )->convertPathToId(
210 220
 			$this->field['path'],
211 221
 			$this->getFieldPrefix()
Please login to merge, or discard this patch.
plugin/Modules/Validator.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -73,7 +73,9 @@  discard block
 block discarded – undo
73 73
 		foreach( $this->rules as $attribute => $rules ) {
74 74
 			foreach( $rules as $rule ) {
75 75
 				$this->validateAttribute( $attribute, $rule );
76
-				if( $this->shouldStopValidating( $attribute ))break;
76
+				if( $this->shouldStopValidating( $attribute )) {
77
+					break;
78
+				}
77 79
 			}
78 80
 		}
79 81
 		return $this->errors;
@@ -89,7 +91,9 @@  discard block
 block discarded – undo
89 91
 	public function validateAttribute( $attribute, $rule )
90 92
 	{
91 93
 		list( $rule, $parameters ) = $this->parseRule( $rule );
92
-		if( $rule == '' )return;
94
+		if( $rule == '' ) {
95
+			return;
96
+		}
93 97
 		$value = $this->getValue( $attribute );
94 98
 		if( !method_exists( $this, $method = 'validate'.$rule )) {
95 99
 			throw new BadMethodCallException( "Method [$method] does not exist." );
@@ -158,7 +162,9 @@  discard block
 block discarded – undo
158 162
 	 */
159 163
 	protected function getRule( $attribute, $rules )
160 164
 	{
161
-		if( !array_key_exists( $attribute, $this->rules ))return;
165
+		if( !array_key_exists( $attribute, $this->rules )) {
166
+			return;
167
+		}
162 168
 		$rules = (array) $rules;
163 169
 		foreach( $this->rules[$attribute] as $rule ) {
164 170
 			list( $rule, $parameters ) = $this->parseRule( $rule );
@@ -318,7 +324,9 @@  discard block
 block discarded – undo
318 324
 		$message = isset( $strings[$key] )
319 325
 			? $strings[$key]
320 326
 			: false;
321
-		if( !$message )return;
327
+		if( !$message ) {
328
+			return;
329
+		}
322 330
 		if( method_exists( $this, $method = 'replace'.$rule )) {
323 331
 			$message = $this->$method( $message, $parameters );
324 332
 		}
Please login to merge, or discard this patch.
plugin/Handlers/CreateReview.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,7 +102,9 @@  discard block
 block discarded – undo
102 102
 	protected function sendNotification( $postId )
103 103
 	{
104 104
 		$notificationType = glsr( OptionManager::class )->get( 'settings.general.notification' );
105
-		if( !in_array( $notificationType, ['default','custom','webhook'] ))return;
105
+		if( !in_array( $notificationType, ['default','custom','webhook'] )) {
106
+			return;
107
+		}
106 108
 		$assignedToTitle = get_the_title( (int)$this->command->assigned_to );
107 109
 		$notificationSubject = _nx(
108 110
 			'New %s-star review',
@@ -150,7 +152,9 @@  discard block
 block discarded – undo
150 152
 	 */
151 153
 	protected function sendWebhookNotification( array $args )
152 154
 	{
153
-		if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' )))return;
155
+		if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' ))) {
156
+			return;
157
+		}
154 158
 		$notification = $this->createWebhookNotification( $args );
155 159
 		$result = wp_remote_post( $endpoint, [
156 160
 			'blocking' => false,
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
@@ -193,8 +193,12 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	protected function validateAkismet()
195 195
 	{
196
-		if( !empty( $this->error ))return;
197
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
196
+		if( !empty( $this->error )) {
197
+			return;
198
+		}
199
+		if( !glsr( Akismet::class )->isSpam( $this->request )) {
200
+			return;
201
+		}
198 202
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' );
199 203
 		$this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' );
200 204
 	}
@@ -204,8 +208,12 @@  discard block
 block discarded – undo
204 208
 	 */
205 209
 	protected function validateBlacklist()
206 210
 	{
207
-		if( !empty( $this->error ))return;
208
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
211
+		if( !empty( $this->error )) {
212
+			return;
213
+		}
214
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) {
215
+			return;
216
+		}
209 217
 		$blacklistAction = $this->getOption( 'settings.submissions.blacklist.action' );
210 218
 		if( $blacklistAction == 'reject' ) {
211 219
 			$this->setSessionValues( 'errors', [], 'Blacklisted submission detected:' );
@@ -220,9 +228,13 @@  discard block
 block discarded – undo
220 228
 	 */
221 229
 	protected function validateCustom()
222 230
 	{
223
-		if( !empty( $this->error ))return;
231
+		if( !empty( $this->error )) {
232
+			return;
233
+		}
224 234
 		$validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request );
225
-		if( $validated === true )return;
235
+		if( $validated === true ) {
236
+			return;
237
+		}
226 238
 		$this->setSessionValues( 'errors', [] );
227 239
 		$this->setSessionValues( 'values', $this->request );
228 240
 		$this->error = is_string( $validated )
@@ -235,8 +247,12 @@  discard block
 block discarded – undo
235 247
 	 */
236 248
 	protected function validateHoneyPot()
237 249
 	{
238
-		if( !empty( $this->error ))return;
239
-		if( empty( $this->request['gotcha'] ))return;
250
+		if( !empty( $this->error )) {
251
+			return;
252
+		}
253
+		if( empty( $this->request['gotcha'] )) {
254
+			return;
255
+		}
240 256
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
241 257
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
242 258
 	}
@@ -246,7 +262,9 @@  discard block
 block discarded – undo
246 262
 	 */
247 263
 	protected function validateRecaptcha()
248 264
 	{
249
-		if( !empty( $this->error ))return;
265
+		if( !empty( $this->error )) {
266
+			return;
267
+		}
250 268
 		$isValid = $this->isRecaptchaResponseValid();
251 269
 		if( is_null( $isValid )) {
252 270
 			$this->setSessionValues( 'recaptcha', true );
Please login to merge, or discard this patch.
plugin/Controllers/TaxonomyController.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 renderTaxonomyFilter()
37 37
 	{
38
-		if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY ))return;
38
+		if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY )) {
39
+			return;
40
+		}
39 41
 		glsr( Html::class )->render()->label( __( 'Filter by category', 'site-reviews' ), [
40 42
 			'class' => 'screen-reader-text',
41 43
 			'for' => Application::TAXONOMY,
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController/Columns.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,7 +86,9 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function renderFilters( $postType )
88 88
 	{
89
-		if( $postType !== Application::POST_TYPE )return;
89
+		if( $postType !== Application::POST_TYPE ) {
90
+			return;
91
+		}
90 92
 		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
91 93
 			$status = 'publish';
92 94
 		}
@@ -103,7 +105,9 @@  discard block
 block discarded – undo
103 105
 	 */
104 106
 	public function renderValues( $column, $postId )
105 107
 	{
106
-		if( glsr_current_screen()->post_type != Application::POST_TYPE )return;
108
+		if( glsr_current_screen()->post_type != Application::POST_TYPE ) {
109
+			return;
110
+		}
107 111
 		$method = glsr( Helper::class )->buildMethodName( $column, 'buildColumn' );
108 112
 		echo method_exists( $this, $method )
109 113
 			? call_user_func( [$this, $method], $postId )
@@ -116,7 +120,9 @@  discard block
 block discarded – undo
116 120
 	 */
117 121
 	protected function renderFilterRatings( $ratings )
118 122
 	{
119
-		if( empty( $ratings ))return;
123
+		if( empty( $ratings )) {
124
+			return;
125
+		}
120 126
 		$ratings = array_flip( array_reverse( $ratings ));
121 127
 		array_walk( $ratings, function( &$value, $key ) {
122 128
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
@@ -139,7 +145,9 @@  discard block
 block discarded – undo
139 145
 	 */
140 146
 	protected function renderFilterTypes( $types )
141 147
 	{
142
-		if( count( glsr()->reviewTypes ) < 2 )return;
148
+		if( count( glsr()->reviewTypes ) < 2 ) {
149
+			return;
150
+		}
143 151
 		echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
144 152
 			'class' => 'screen-reader-text',
145 153
 			'for' => 'review_type',
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Labels.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,9 @@
 block discarded – undo
48 48
 	public function filterUpdateMessages( array $messages )
49 49
 	{
50 50
 		$post = get_post();
51
-		if( !( $post instanceof WP_Post ))return;
51
+		if( !( $post instanceof WP_Post )) {
52
+			return;
53
+		}
52 54
 		$strings = $this->getReviewLabels();
53 55
 		$restored = filter_input( INPUT_GET, 'revision' );
54 56
 		if( $revisionTitle = wp_post_revision_title( intval( $restored ), false )) {
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Metaboxes.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function onCreateReview( $postData, $meta, $postId )
24 24
 	{
25
-		if( !$this->isReviewPostType( $review = get_post( $postId )))return;
25
+		if( !$this->isReviewPostType( $review = get_post( $postId ))) {
26
+			return;
27
+		}
26 28
 		$this->updateAssignedToPost( $review );
27 29
 	}
28 30
 
@@ -32,7 +34,9 @@  discard block
 block discarded – undo
32 34
 	 */
33 35
 	public function onDeleteReview( $postId )
34 36
 	{
35
-		if( !$this->isReviewPostType( $review = get_post( $postId )))return;
37
+		if( !$this->isReviewPostType( $review = get_post( $postId ))) {
38
+			return;
39
+		}
36 40
 		$review->post_status = 'deleted'; // important to change the post_status here first!
37 41
 		$this->updateAssignedToPost( $review );
38 42
 	}
@@ -52,7 +56,9 @@  discard block
 block discarded – undo
52 56
 	 */
53 57
 	public function saveAssignedToMetabox( $postId )
54 58
 	{
55
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return;
59
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' )) {
60
+			return;
61
+		}
56 62
 		$assignedTo = glsr( Helper::class )->filterInput( 'assigned_to' );
57 63
 		$assignedTo || $assignedTo = '';
58 64
 		if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) {
@@ -67,7 +73,9 @@  discard block
 block discarded – undo
67 73
 	 */
68 74
 	public function saveResponseMetabox( $postId )
69 75
 	{
70
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return;
76
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' )) {
77
+			return;
78
+		}
71 79
 		$response = glsr( Helper::class )->filterInput( 'response' );
72 80
 		$response || $response = '';
73 81
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
@@ -120,9 +128,13 @@  discard block
 block discarded – undo
120 128
 	 */
121 129
 	protected function updateAssignedToPost( WP_Post $review )
122 130
 	{
123
-		if( !( $postId = $this->getAssignedToPostId( $review->ID )))return;
131
+		if( !( $postId = $this->getAssignedToPostId( $review->ID ))) {
132
+			return;
133
+		}
124 134
 		$reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
125
-		if( empty( $reviewIds ))return;
135
+		if( empty( $reviewIds )) {
136
+			return;
137
+		}
126 138
 		$this->updateReviewIdOfPost( $postId, $review, $reviewIds );
127 139
 		$updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
128 140
 		if( empty( $updatedReviewIds )) {
Please login to merge, or discard this patch.