Passed
Push — master ( 211fe0...c1039b )
by Paul
03:43
created
plugin/Modules/Upgrader.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 		natsort( $routines );
18 18
 		array_walk( $routines, function( $routine ) {
19 19
 			$parts = explode( '__', $routine );
20
-			if( version_compare( glsr()->version, end( $parts ), '<' ))return;
20
+			if( version_compare( glsr()->version, end( $parts ), '<' )) {
21
+				return;
22
+			}
21 23
 			call_user_func( [$this, $routine] );
22 24
 		});
23 25
 		$this->updateVersion();
Please login to merge, or discard this patch.
plugin/Modules/Schema.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 		foreach( glsr( ReviewManager::class )->get( $this->args )->results as $review ) {
41 41
 			// Only include critic reviews that have been directly produced by your site, not reviews from third- party sites or syndicated reviews.
42 42
 			// @see https://developers.google.com/search/docs/data-types/review
43
-			if( $review->review_type != 'local' )continue;
43
+			if( $review->review_type != 'local' ) {
44
+				continue;
45
+			}
44 46
 			$reviews[] = $this->buildReview( $review );
45 47
 		}
46 48
 		if( !empty( $reviews )) {
@@ -85,7 +87,9 @@  discard block
 block discarded – undo
85 87
 	 */
86 88
 	public function render()
87 89
 	{
88
-		if( is_null( glsr()->schemas ))return;
90
+		if( is_null( glsr()->schemas )) {
91
+			return;
92
+		}
89 93
 		printf( '<script type="application/ld+json">%s</script>', json_encode(
90 94
 			apply_filters( 'site-reviews/schema/all', glsr()->schemas ),
91 95
 			JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
@@ -137,7 +141,9 @@  discard block
 block discarded – undo
137 141
 	{
138 142
 		foreach( $values as $value ) {
139 143
 			$option = $this->getSchemaOptionValue( $value );
140
-			if( empty( $option ))continue;
144
+			if( empty( $option )) {
145
+				continue;
146
+			}
141 147
 			$schema->$value( $option );
142 148
 		}
143 149
 		return $schema;
@@ -249,7 +255,9 @@  discard block
 block discarded – undo
249 255
 		if( $value != $fallback ) {
250 256
 			return $value;
251 257
 		}
252
-		if( !is_single() && !is_page() )return;
258
+		if( !is_single() && !is_page() ) {
259
+			return;
260
+		}
253 261
 		$method = glsr( Helper::class )->buildMethodName( $option, 'getThing' );
254 262
 		if( method_exists( $this, $method )) {
255 263
 			return $this->$method();
@@ -327,7 +335,9 @@  discard block
 block discarded – undo
327 335
 		$termIds = array_map( 'trim', explode( ',', $this->args['category'] ));
328 336
 		foreach( $termIds as $termId ) {
329 337
 			$term = get_term( $termId, Application::TAXONOMY );
330
-			if( !isset( $term->term_id ))continue;
338
+			if( !isset( $term->term_id )) {
339
+				continue;
340
+			}
331 341
 			$this->reviewCounts[] = glsr( CountsManager::class )->getTermCounts( $termId );
332 342
 		}
333 343
 	}
Please login to merge, or discard this patch.
plugin/Database/CountsManager.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -73,7 +73,9 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function decreasePostCounts( Review $review )
75 75
 	{
76
-		if( empty( $counts = $this->getPostCounts( $review->assigned_to )))return;
76
+		if( empty( $counts = $this->getPostCounts( $review->assigned_to ))) {
77
+			return;
78
+		}
77 79
 		$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
78 80
 		$this->setPostCounts( $review->assigned_to, $counts );
79 81
 	}
@@ -84,7 +86,9 @@  discard block
 block discarded – undo
84 86
 	public function decreaseTermCounts( Review $review )
85 87
 	{
86 88
 		foreach( $review->term_ids as $termId ) {
87
-			if( empty( $counts = $this->getTermCounts( $termId )))continue;
89
+			if( empty( $counts = $this->getTermCounts( $termId ))) {
90
+				continue;
91
+			}
88 92
 			$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
89 93
 			$this->setTermCounts( $termId, $counts );
90 94
 		}
@@ -104,7 +108,9 @@  discard block
 block discarded – undo
104 108
 		$args = wp_parse_args( $args, ['max' => Rating::MAX_RATING, 'min' => Rating::MIN_RATING] );
105 109
 		array_walk( $counts, function( &$ratings ) use( $args ) {
106 110
 			foreach( $ratings as $index => &$num ) {
107
-				if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue;
111
+				if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] )) {
112
+					continue;
113
+				}
108 114
 				$num = 0;
109 115
 			}
110 116
 		});
@@ -167,7 +173,9 @@  discard block
 block discarded – undo
167 173
 	 */
168 174
 	public function increasePostCounts( Review $review )
169 175
 	{
170
-		if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return;
176
+		if( !( get_post( $review->assigned_to ) instanceof WP_Post )) {
177
+			return;
178
+		}
171 179
 		if( empty( $counts = $this->getPostCounts( $review->assigned_to ))) {
172 180
 			$counts = $this->buildPostCounts( $review->assigned_to );
173 181
 		}
@@ -181,7 +189,9 @@  discard block
 block discarded – undo
181 189
 	public function increaseTermCounts( Review $review )
182 190
 	{
183 191
 		foreach( $review->term_ids as $termId ) {
184
-			if( !( get_term( $termId, Application::TAXONOMY ) instanceof WP_Term ))continue;
192
+			if( !( get_term( $termId, Application::TAXONOMY ) instanceof WP_Term )) {
193
+				continue;
194
+			}
185 195
 			if( empty( $counts = $this->getTermCounts( $termId ))) {
186 196
 				$counts = $this->buildTermCounts( $termId );
187 197
 			}
@@ -216,7 +226,9 @@  discard block
 block discarded – undo
216 226
 	 */
217 227
 	public function setTermCounts( $termId, array $reviewCounts )
218 228
 	{
219
-		if( !term_exists( $termId ))return;
229
+		if( !term_exists( $termId )) {
230
+			return;
231
+		}
220 232
 		$ratingCounts = glsr( CountsManager::class )->flatten( $reviewCounts );
221 233
 		update_term_meta( $termId, static::META_COUNT, $reviewCounts );
222 234
 		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
@@ -234,7 +246,9 @@  discard block
 block discarded – undo
234 246
 		while( $reviews = $this->queryReviews( $args, $lastPostId, $limit )) {
235 247
 			$types = array_keys( array_flip( array_column( $reviews, 'type' )));
236 248
 			foreach( $types as $type ) {
237
-				if( isset( $counts[$type] ))continue;
249
+				if( isset( $counts[$type] )) {
250
+					continue;
251
+				}
238 252
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
239 253
 			}
240 254
 			foreach( $reviews as $review ) {
@@ -283,7 +297,9 @@  discard block
 block discarded – undo
283 297
 	{
284 298
 		foreach( $reviewCounts as &$counts ) {
285 299
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
286
-				if( isset( $counts[$index] ))continue;
300
+				if( isset( $counts[$index] )) {
301
+					continue;
302
+				}
287 303
 				$counts[$index] = 0;
288 304
 			}
289 305
 			ksort( $counts );
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Metaboxes.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	public function saveAssignedToMetabox( $postId )
15 15
 	{
16
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return;
16
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' )) {
17
+			return;
18
+		}
17 19
 		$assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ));
18 20
 		if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) {
19 21
 			$review = glsr( ReviewManager::class )->single( get_post( $postId ));
@@ -28,7 +30,9 @@  discard block
 block discarded – undo
28 30
 	 */
29 31
 	public function saveResponseMetabox( $postId )
30 32
 	{
31
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return;
33
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' )) {
34
+			return;
35
+		}
32 36
 		$response = strval( glsr( Helper::class )->filterInput( 'response' ));
33 37
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
34 38
 			'a' => ['href' => [], 'title' => []],
Please login to merge, or discard this patch.
plugin/Controllers/ReviewController.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function onAfterChangeCategory( $postId, $terms, $termIds, $taxonomySlug, $append, $oldTermIds )
25 25
 	{
26
-		if( !$this->isReviewPostId( $postId ))return;
26
+		if( !$this->isReviewPostId( $postId )) {
27
+			return;
28
+		}
27 29
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
28 30
 		$ignoredTerms = array_intersect( $oldTermIds, $termIds );
29 31
 		$review->term_ids = array_diff( $oldTermIds, $ignoredTerms );
@@ -41,7 +43,9 @@  discard block
 block discarded – undo
41 43
 	 */
42 44
 	public function onAfterCreate( $postData, $meta, $postId )
43 45
 	{
44
-		if( !$this->isReviewPostId( $postId ))return;
46
+		if( !$this->isReviewPostId( $postId )) {
47
+			return;
48
+		}
45 49
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
46 50
 		glsr( CountsManager::class )->increase( $review );
47 51
 	}
@@ -53,7 +57,9 @@  discard block
 block discarded – undo
53 57
 	 */
54 58
 	public function onBeforeDelete( $postId )
55 59
 	{
56
-		if( !$this->isReviewPostId( $postId ))return;
60
+		if( !$this->isReviewPostId( $postId )) {
61
+			return;
62
+		}
57 63
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
58 64
 		glsr( CountsManager::class )->decrease( $review );
59 65
 	}
@@ -70,9 +76,13 @@  discard block
 block discarded – undo
70 76
 	{
71 77
 		if( !$this->isReviewPostId( $postId )
72 78
 			|| !in_array( $metaKey, ['assigned_to', 'rating', 'review_type'] )
73
-		)return;
79
+		) {
80
+			return;
81
+		}
74 82
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
75
-		if( $review->$metaKey == $metaValue )return;
83
+		if( $review->$metaKey == $metaValue ) {
84
+			return;
85
+		}
76 86
 		$method = glsr( Helper::class )->buildMethodName( $metaKey, 'onBeforeChange' );
77 87
 		call_user_func( [$this, $method], $review, $metaValue );
78 88
 	}
@@ -118,7 +128,9 @@  discard block
 block discarded – undo
118 128
 	 */
119 129
 	public function onChangeStatus( $newStatus, $oldStatus, WP_Post $post )
120 130
 	{
121
-		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ))return;
131
+		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] )) {
132
+			return;
133
+		}
122 134
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
123 135
 		if( $status == 'publish' ) {
124 136
 			glsr( CountsManager::class )->increase( $review );
Please login to merge, or discard this patch.