@@ -74,7 +74,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 )); |
@@ -266,7 +276,9 @@ discard block |
||
266 | 276 | while( $reviews = $this->queryReviews( $args, $lastPostId, $limit )) { |
267 | 277 | $types = array_keys( array_flip( array_column( $reviews, 'type' ))); |
268 | 278 | foreach( $types as $type ) { |
269 | - if( isset( $counts[$type] ))continue; |
|
279 | + if( isset( $counts[$type] )) { |
|
280 | + continue; |
|
281 | + } |
|
270 | 282 | $type = $this->normalizeType( $type ); |
271 | 283 | $counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 ); |
272 | 284 | } |
@@ -320,7 +332,9 @@ discard block |
||
320 | 332 | } |
321 | 333 | foreach( $reviewCounts as &$counts ) { |
322 | 334 | foreach( range( 0, Rating::MAX_RATING ) as $index ) { |
323 | - if( isset( $counts[$index] ))continue; |
|
335 | + if( isset( $counts[$index] )) { |
|
336 | + continue; |
|
337 | + } |
|
324 | 338 | $counts[$index] = 0; |
325 | 339 | } |
326 | 340 | ksort( $counts ); |