@@ -34,7 +34,9 @@ discard block |
||
| 34 | 34 | $types = array_unique( array_merge( ['local'], $types )); |
| 35 | 35 | foreach( $types as $type ) { |
| 36 | 36 | $type = $this->normalizeType( $type ); |
| 37 | - if( isset( $counts[$type] ))continue; |
|
| 37 | + if( isset( $counts[$type] )) { |
|
| 38 | + continue; |
|
| 39 | + } |
|
| 38 | 40 | $counts[$type] = array_fill_keys( range( 0, glsr()->constant( 'MAX_RATING', Rating::class )), 0 ); |
| 39 | 41 | } |
| 40 | 42 | foreach( $query->reviews as $review ) { |
@@ -109,7 +111,9 @@ discard block |
||
| 109 | 111 | */ |
| 110 | 112 | public function decreasePostCounts( Review $review ) |
| 111 | 113 | { |
| 112 | - if( empty( $counts = $this->getPostCounts( $review->assigned_to )))return; |
|
| 114 | + if( empty( $counts = $this->getPostCounts( $review->assigned_to ))) { |
|
| 115 | + return; |
|
| 116 | + } |
|
| 113 | 117 | $counts = $this->decreaseRating( $counts, $review->review_type, $review->rating ); |
| 114 | 118 | $this->setPostCounts( $review->assigned_to, $counts ); |
| 115 | 119 | } |
@@ -120,7 +124,9 @@ discard block |
||
| 120 | 124 | public function decreaseTermCounts( Review $review ) |
| 121 | 125 | { |
| 122 | 126 | foreach( $review->term_ids as $termId ) { |
| 123 | - if( empty( $counts = $this->getTermCounts( $termId )))continue; |
|
| 127 | + if( empty( $counts = $this->getTermCounts( $termId ))) { |
|
| 128 | + continue; |
|
| 129 | + } |
|
| 124 | 130 | $counts = $this->decreaseRating( $counts, $review->review_type, $review->rating ); |
| 125 | 131 | $this->setTermCounts( $termId, $counts ); |
| 126 | 132 | } |
@@ -140,7 +146,9 @@ discard block |
||
| 140 | 146 | 'min' => glsr()->constant( 'MIN_RATING', Rating::class ), |
| 141 | 147 | ]); |
| 142 | 148 | foreach( $counts as $index => &$num ) { |
| 143 | - if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue; |
|
| 149 | + if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] )) { |
|
| 150 | + continue; |
|
| 151 | + } |
|
| 144 | 152 | $num = 0; |
| 145 | 153 | } |
| 146 | 154 | return $counts; |
@@ -229,7 +237,9 @@ discard block |
||
| 229 | 237 | */ |
| 230 | 238 | public function increasePostCounts( Review $review ) |
| 231 | 239 | { |
| 232 | - if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return; |
|
| 240 | + if( !( get_post( $review->assigned_to ) instanceof WP_Post )) { |
|
| 241 | + return; |
|
| 242 | + } |
|
| 233 | 243 | $counts = $this->getPostCounts( $review->assigned_to ); |
| 234 | 244 | $counts = empty( $counts ) |
| 235 | 245 | ? $this->buildPostCounts( $review->assigned_to ) |
@@ -279,7 +289,9 @@ discard block |
||
| 279 | 289 | public function setTermCounts( $termId, array $reviewCounts ) |
| 280 | 290 | { |
| 281 | 291 | $term = get_term( $termId, Application::TAXONOMY ); |
| 282 | - if( !isset( $term->term_id ))return; |
|
| 292 | + if( !isset( $term->term_id )) { |
|
| 293 | + return; |
|
| 294 | + } |
|
| 283 | 295 | $ratingCounts = $this->flatten( $reviewCounts ); |
| 284 | 296 | update_term_meta( $termId, static::META_COUNT, $reviewCounts ); |
| 285 | 297 | update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts )); |
@@ -335,7 +347,9 @@ discard block |
||
| 335 | 347 | } |
| 336 | 348 | foreach( $reviewCounts as &$counts ) { |
| 337 | 349 | foreach( range( 0, glsr()->constant( 'MAX_RATING', Rating::class )) as $index ) { |
| 338 | - if( isset( $counts[$index] ))continue; |
|
| 350 | + if( isset( $counts[$index] )) { |
|
| 351 | + continue; |
|
| 352 | + } |
|
| 339 | 353 | $counts[$index] = 0; |
| 340 | 354 | } |
| 341 | 355 | ksort( $counts ); |
@@ -40,7 +40,9 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public function __toString() |
| 42 | 42 | { |
| 43 | - if( empty( $this->values ))return; |
|
| 43 | + if( empty( $this->values )) { |
|
| 44 | + return; |
|
| 45 | + } |
|
| 44 | 46 | return glsr( Template::class )->build( 'templates/review', [ |
| 45 | 47 | 'context' => $this->values, |
| 46 | 48 | 'review' => $this->review, |