Passed
Push — master ( aaffa2...4bbf0d )
by Paul
10:08 queued 04:27
created
plugin/Database/CountsManager.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function decreasePostCounts( Review $review )
76 76
 	{
77
-		if( empty( $counts = $this->getPostCounts( $review->assigned_to )))return;
77
+		if( empty( $counts = $this->getPostCounts( $review->assigned_to ))) {
78
+			return;
79
+		}
78 80
 		$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
79 81
 		$this->setPostCounts( $review->assigned_to, $counts );
80 82
 	}
@@ -85,7 +87,9 @@  discard block
 block discarded – undo
85 87
 	public function decreaseTermCounts( Review $review )
86 88
 	{
87 89
 		foreach( $review->term_ids as $termId ) {
88
-			if( empty( $counts = $this->getTermCounts( $termId )))continue;
90
+			if( empty( $counts = $this->getTermCounts( $termId ))) {
91
+				continue;
92
+			}
89 93
 			$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
90 94
 			$this->setTermCounts( $termId, $counts );
91 95
 		}
@@ -107,7 +111,9 @@  discard block
 block discarded – undo
107 111
 			'min' => Rating::MIN_RATING,
108 112
 		]);
109 113
 		foreach( $counts as $index => &$num ) {
110
-			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue;
114
+			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] )) {
115
+				continue;
116
+			}
111 117
 			$num = 0;
112 118
 		}
113 119
 		return $counts;
@@ -199,7 +205,9 @@  discard block
 block discarded – undo
199 205
 	 */
200 206
 	public function increasePostCounts( Review $review )
201 207
 	{
202
-		if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return;
208
+		if( !( get_post( $review->assigned_to ) instanceof WP_Post )) {
209
+			return;
210
+		}
203 211
 		$counts = $this->getPostCounts( $review->assigned_to );
204 212
 		$counts = empty( $counts )
205 213
 			? $this->buildPostCounts( $review->assigned_to )
@@ -248,7 +256,9 @@  discard block
 block discarded – undo
248 256
 	 */
249 257
 	public function setTermCounts( $termId, array $reviewCounts )
250 258
 	{
251
-		if( !term_exists( $termId ))return;
259
+		if( !term_exists( $termId )) {
260
+			return;
261
+		}
252 262
 		$ratingCounts = $this->flatten( $reviewCounts );
253 263
 		update_term_meta( $termId, static::META_COUNT, $reviewCounts );
254 264
 		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
@@ -268,7 +278,9 @@  discard block
 block discarded – undo
268 278
 			$types = array_unique( array_merge( ['local'], $types ));
269 279
 			foreach( $types as $type ) {
270 280
 				$type = $this->normalizeType( $type );
271
-				if( isset( $counts[$type] ))continue;
281
+				if( isset( $counts[$type] )) {
282
+					continue;
283
+				}
272 284
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
273 285
 			}
274 286
 			foreach( $reviews as $review ) {
@@ -321,7 +333,9 @@  discard block
 block discarded – undo
321 333
 		}
322 334
 		foreach( $reviewCounts as &$counts ) {
323 335
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
324
-				if( isset( $counts[$index] ))continue;
336
+				if( isset( $counts[$index] )) {
337
+					continue;
338
+				}
325 339
 				$counts[$index] = 0;
326 340
 			}
327 341
 			ksort( $counts );
Please login to merge, or discard this patch.