Test Failed
Push — hotfix/fix-counts ( 1fe4ce...872cd6 )
by Paul
03:14
created
plugin/Shortcodes/Shortcode.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,9 @@  discard block
 block discarded – undo
93 93
 		$args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ));
94 94
 		array_walk( $args, function( &$value, $key ) {
95 95
 			$methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' );
96
-			if( !method_exists( $this, $methodName ))return;
96
+			if( !method_exists( $this, $methodName )) {
97
+				return;
98
+			}
97 99
 			$value = $this->$methodName( $value );
98 100
 		});
99 101
 		return $this->sanitize( $args );
@@ -168,7 +170,9 @@  discard block
 block discarded – undo
168 170
 		$defaults = array_pad( $defaults, glsr()->constant( 'MAX_RATING', Rating::class ), '' );
169 171
 		$labels = array_map( 'trim', explode( ',', $labels ));
170 172
 		foreach( $defaults as $i => $label ) {
171
-			if( empty( $labels[$i] ))continue;
173
+			if( empty( $labels[$i] )) {
174
+				continue;
175
+			}
172 176
 			$defaults[$i] = $labels[$i];
173 177
 		}
174 178
 		return array_combine( range( glsr()->constant( 'MAX_RATING', Rating::class ), 1 ), $defaults );
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviewsSummary.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 	{
35 35
 		$this->args = $args;
36 36
 		$this->ratingCounts = glsr( ReviewManager::class )->getRatingCounts( $args );
37
-		if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ))return;
37
+		if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' )) {
38
+			return;
39
+		}
38 40
 		$this->averageRating = glsr( Rating::class )->getAverage( $this->ratingCounts );
39 41
 		$this->generateSchema();
40 42
 		return glsr( Template::class )->build( 'templates/reviews-summary', [
@@ -56,7 +58,9 @@  discard block
 block discarded – undo
56 58
 	 */
57 59
 	protected function buildPercentage()
58 60
 	{
59
-		if( $this->isHidden( 'bars' ))return;
61
+		if( $this->isHidden( 'bars' )) {
62
+			return;
63
+		}
60 64
 		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts ));
61 65
 		$bars = array_reduce( range( glsr()->constant( 'MAX_RATING', Rating::class ), 1 ), function( $carry, $level ) use( $percentages ) {
62 66
 			$label = $this->buildPercentageLabel( $this->args['labels'][$level] );
@@ -109,7 +113,9 @@  discard block
 block discarded – undo
109 113
 	 */
110 114
 	protected function buildRating()
111 115
 	{
112
-		if( $this->isHidden( 'rating' ))return;
116
+		if( $this->isHidden( 'rating' )) {
117
+			return;
118
+		}
113 119
 		return $this->wrap( 'rating', '<span>'.$this->averageRating.'</span>' );
114 120
 	}
115 121
 
@@ -118,7 +124,9 @@  discard block
 block discarded – undo
118 124
 	 */
119 125
 	protected function buildStars()
120 126
 	{
121
-		if( $this->isHidden( 'stars' ))return;
127
+		if( $this->isHidden( 'stars' )) {
128
+			return;
129
+		}
122 130
 		$stars = glsr_star_rating( $this->averageRating );
123 131
 		return $this->wrap( 'stars', $stars );
124 132
 	}
@@ -128,7 +136,9 @@  discard block
 block discarded – undo
128 136
 	 */
129 137
 	protected function buildText()
130 138
 	{
131
-		if( $this->isHidden( 'summary' ))return;
139
+		if( $this->isHidden( 'summary' )) {
140
+			return;
141
+		}
132 142
 		$count = intval( array_sum( $this->ratingCounts ));
133 143
 		if( empty( $this->args['text'] )) {
134 144
 			// @todo document this change
@@ -153,7 +163,9 @@  discard block
 block discarded – undo
153 163
 	 */
154 164
 	protected function generateSchema()
155 165
 	{
156
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
166
+		if( !wp_validate_boolean( $this->args['schema'] )) {
167
+			return;
168
+		}
157 169
 		glsr( Schema::class )->store(
158 170
 			glsr( Schema::class )->buildSummary( $this->args )
159 171
 		);
Please login to merge, or discard this patch.
plugin/Modules/System.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -107,7 +107,9 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function getMuPluginDetails()
109 109
 	{
110
-		if( empty( $plugins = get_mu_plugins() ))return;
110
+		if( empty( $plugins = get_mu_plugins() )) {
111
+			return;
112
+		}
111 113
 		return $this->normalizePluginList( $plugins );
112 114
 	}
113 115
 
@@ -117,7 +119,9 @@  discard block
 block discarded – undo
117 119
 	public function getMultisitePluginDetails()
118 120
 	{
119 121
 		$activePlugins = (array)get_site_option( 'active_sitewide_plugins', [] );
120
-		if( !is_multisite() || empty( $activePlugins ))return;
122
+		if( !is_multisite() || empty( $activePlugins )) {
123
+			return;
124
+		}
121 125
 		return $this->normalizePluginList( array_intersect_key( get_plugins(), $activePlugins ));
122 126
 	}
123 127
 
@@ -201,7 +205,9 @@  discard block
 block discarded – undo
201 205
 		ksort( $settings );
202 206
 		$details = [];
203 207
 		foreach( $settings as $key => $value ) {
204
-			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue;
208
+			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key )) {
209
+				continue;
210
+			}
205 211
 			$value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' );
206 212
 			$details[$key] = $value;
207 213
 		}
@@ -277,7 +283,9 @@  discard block
 block discarded – undo
277 283
 			'WPE_APIKEY' => 'WP Engine',
278 284
 		];
279 285
 		foreach( $checks as $key => $value ) {
280
-			if( !$this->isWebhostCheckValid( $key ))continue;
286
+			if( !$this->isWebhostCheckValid( $key )) {
287
+				continue;
288
+			}
281 289
 			return $value;
282 290
 		}
283 291
 		return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ));
@@ -358,7 +366,9 @@  discard block
 block discarded – undo
358 366
 		];
359 367
 		array_walk( $settings, function( &$value, $setting ) use( $keys ) {
360 368
 			foreach( $keys as $key ) {
361
-				if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value ))continue;
369
+				if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value )) {
370
+					continue;
371
+				}
362 372
 				$value = str_repeat( '•', 13 );
363 373
 				return;
364 374
 			}
Please login to merge, or discard this patch.
plugin/Database/CountsManager.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 );
Please login to merge, or discard this patch.