Passed
Push — master ( 49ec8d...5de802 )
by Paul
03:41
created
plugin/Database/CountsManager.php 1 patch
Braces   +27 added lines, -9 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
 		}
@@ -106,7 +110,9 @@  discard block
 block discarded – undo
106 110
 			'min' => Rating::MIN_RATING,
107 111
 		]);
108 112
 		foreach( $counts as $index => &$num ) {
109
-			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue;
113
+			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] )) {
114
+				continue;
115
+			}
110 116
 			$num = 0;
111 117
 		}
112 118
 		return $counts;
@@ -128,7 +134,9 @@  discard block
 block discarded – undo
128 134
 		}
129 135
 		foreach( $args['term_ids'] as $termId ) {
130 136
 			$term = get_term( $termId, Application::TAXONOMY );
131
-			if( !isset( $term->term_id ))continue;
137
+			if( !isset( $term->term_id )) {
138
+				continue;
139
+			}
132 140
 			$counts[] = $this->getTermCounts( $termId );
133 141
 		}
134 142
 		if( empty( $counts )) {
@@ -193,7 +201,9 @@  discard block
 block discarded – undo
193 201
 	 */
194 202
 	public function increasePostCounts( Review $review )
195 203
 	{
196
-		if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return;
204
+		if( !( get_post( $review->assigned_to ) instanceof WP_Post )) {
205
+			return;
206
+		}
197 207
 		if( empty( $counts = $this->getPostCounts( $review->assigned_to ))) {
198 208
 			$counts = $this->buildPostCounts( $review->assigned_to );
199 209
 		}
@@ -207,7 +217,9 @@  discard block
 block discarded – undo
207 217
 	public function increaseTermCounts( Review $review )
208 218
 	{
209 219
 		foreach( $review->term_ids as $termId ) {
210
-			if( !( get_term( $termId, Application::TAXONOMY ) instanceof WP_Term ))continue;
220
+			if( !( get_term( $termId, Application::TAXONOMY ) instanceof WP_Term )) {
221
+				continue;
222
+			}
211 223
 			if( empty( $counts = $this->getTermCounts( $termId ))) {
212 224
 				$counts = $this->buildTermCounts( $termId );
213 225
 			}
@@ -242,7 +254,9 @@  discard block
 block discarded – undo
242 254
 	 */
243 255
 	public function setTermCounts( $termId, array $reviewCounts )
244 256
 	{
245
-		if( !term_exists( $termId ))return;
257
+		if( !term_exists( $termId )) {
258
+			return;
259
+		}
246 260
 		$ratingCounts = glsr( CountsManager::class )->flatten( $reviewCounts );
247 261
 		update_term_meta( $termId, static::META_COUNT, $reviewCounts );
248 262
 		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
@@ -260,7 +274,9 @@  discard block
 block discarded – undo
260 274
 		while( $reviews = $this->queryReviews( $args, $lastPostId, $limit )) {
261 275
 			$types = array_keys( array_flip( array_column( $reviews, 'type' )));
262 276
 			foreach( $types as $type ) {
263
-				if( isset( $counts[$type] ))continue;
277
+				if( isset( $counts[$type] )) {
278
+					continue;
279
+				}
264 280
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
265 281
 			}
266 282
 			foreach( $reviews as $review ) {
@@ -309,7 +325,9 @@  discard block
 block discarded – undo
309 325
 	{
310 326
 		foreach( $reviewCounts as &$counts ) {
311 327
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
312
-				if( isset( $counts[$index] ))continue;
328
+				if( isset( $counts[$index] )) {
329
+					continue;
330
+				}
313 331
 				$counts[$index] = 0;
314 332
 			}
315 333
 			ksort( $counts );
Please login to merge, or discard this patch.