Passed
Push — master ( a42385...9b46a7 )
by Paul
04:14
created
plugin/Controllers/TaxonomyController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@
 block discarded – undo
35 35
 	 */
36 36
 	public function renderTaxonomyFilter()
37 37
 	{
38
-		if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY ))return;
38
+		if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY )) {
39
+			return;
40
+		}
39 41
 		echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [
40 42
 			'class' => 'screen-reader-text',
41 43
 			'for' => Application::TAXONOMY,
Please login to merge, or discard this patch.
plugin/Database/ReviewManager.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,7 +111,9 @@  discard block
 block discarded – undo
111 111
 		$termIds = glsr( Helper::class )->convertStringToArray( $commaSeparatedTermIds );
112 112
 		foreach( $termIds as $termId ) {
113 113
 			$term = get_term( $termId, Application::TAXONOMY );
114
-			if( !isset( $term->term_id ))continue;
114
+			if( !isset( $term->term_id )) {
115
+				continue;
116
+			}
115 117
 			$terms[] = $term->term_id;
116 118
 		}
117 119
 		return $terms;
@@ -123,7 +125,9 @@  discard block
 block discarded – undo
123 125
 	 */
124 126
 	public function revert( $postId )
125 127
 	{
126
-		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return;
128
+		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE ) {
129
+			return;
130
+		}
127 131
 		delete_post_meta( $postId, '_edit_last' );
128 132
 		$result = wp_update_post([
129 133
 			'ID' => $postId,
@@ -141,7 +145,9 @@  discard block
 block discarded – undo
141 145
 	 */
142 146
 	public function single( WP_Post $post )
143 147
 	{
144
-		if( $post->post_type != Application::POST_TYPE )return;
148
+		if( $post->post_type != Application::POST_TYPE ) {
149
+			return;
150
+		}
145 151
 		$review = new Review( $post );
146 152
 		return apply_filters( 'site-reviews/get/review', $review, $post );
147 153
 	}
@@ -166,7 +172,9 @@  discard block
 block discarded – undo
166 172
 	protected function setTerms( $postId, $termIds )
167 173
 	{
168 174
 		$terms = $this->normalizeTerms( $termIds );
169
-		if( empty( $terms ))return;
175
+		if( empty( $terms )) {
176
+			return;
177
+		}
170 178
 		$result = wp_set_object_terms( $postId, $terms, Application::TAXONOMY );
171 179
 		if( is_wp_error( $result )) {
172 180
 			glsr_log()->error( $result->get_error_message() );
Please login to merge, or discard this patch.
plugin/Database/QueryBuilder.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,9 +17,13 @@  discard block
 block discarded – undo
17 17
 	{
18 18
 		$queries = [];
19 19
 		foreach( $keys as $key ) {
20
-			if( !array_key_exists( $key, $values ))continue;
20
+			if( !array_key_exists( $key, $values )) {
21
+				continue;
22
+			}
21 23
 			$methodName = glsr( Helper::class )->buildMethodName( $key, __FUNCTION__ );
22
-			if( !method_exists( $this, $methodName ))continue;
24
+			if( !method_exists( $this, $methodName )) {
25
+				continue;
26
+			}
23 27
 			$query = call_user_func( [$this, $methodName], $values[$key] );
24 28
 			if( is_array( $query )) {
25 29
 				$queries[] = $query;
@@ -36,7 +40,9 @@  discard block
 block discarded – undo
36 40
 		$string = '';
37 41
 		$values = array_filter( $values );
38 42
 		foreach( $conditions as $key => $value ) {
39
-			if( !isset( $values[$key] ))continue;
43
+			if( !isset( $values[$key] )) {
44
+				continue;
45
+			}
40 46
 			$values[$key] = implode( ',', (array)$values[$key] );
41 47
 			$string .= strpos( $value, '%s' ) !== false
42 48
 				? sprintf( $value, strval( $values[$key] ))
@@ -110,7 +116,9 @@  discard block
 block discarded – undo
110 116
 	 */
111 117
 	protected function buildQueryAssignedTo( $value )
112 118
 	{
113
-		if( empty( $value ))return;
119
+		if( empty( $value )) {
120
+			return;
121
+		}
114 122
 		$postIds = glsr( Helper::class )->convertStringToArray( $value, 'is_numeric' );
115 123
 		return [
116 124
 			'compare' => 'IN',
@@ -125,7 +133,9 @@  discard block
 block discarded – undo
125 133
 	 */
126 134
 	protected function buildQueryCategory( $value )
127 135
 	{
128
-		if( empty( $value ))return;
136
+		if( empty( $value )) {
137
+			return;
138
+		}
129 139
 		return [
130 140
 			'field' => 'term_id',
131 141
 			'taxonomy' => Application::TAXONOMY,
@@ -139,7 +149,9 @@  discard block
 block discarded – undo
139 149
 	 */
140 150
 	protected function buildQueryRating( $value )
141 151
 	{
142
-		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return;
152
+		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) {
153
+			return;
154
+		}
143 155
 		return [
144 156
 			'compare' => '>=',
145 157
 			'key' => 'rating',
@@ -153,7 +165,9 @@  discard block
 block discarded – undo
153 165
 	 */
154 166
 	protected function buildQueryType( $value )
155 167
 	{
156
-		if( in_array( $value, ['','all'] ))return;
168
+		if( in_array( $value, ['','all'] )) {
169
+			return;
170
+		}
157 171
 		return [
158 172
 			'key' => 'review_type',
159 173
 			'value' => $value,
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
@@ -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;
@@ -192,7 +198,9 @@  discard block
 block discarded – undo
192 198
 	 */
193 199
 	public function increasePostCounts( Review $review )
194 200
 	{
195
-		if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return;
201
+		if( !( get_post( $review->assigned_to ) instanceof WP_Post )) {
202
+			return;
203
+		}
196 204
 		$counts = $this->getPostCounts( $review->assigned_to );
197 205
 		$counts = empty( $counts )
198 206
 			? $this->buildPostCounts( $review->assigned_to )
@@ -241,7 +249,9 @@  discard block
 block discarded – undo
241 249
 	 */
242 250
 	public function setTermCounts( $termId, array $reviewCounts )
243 251
 	{
244
-		if( !term_exists( $termId ))return;
252
+		if( !term_exists( $termId )) {
253
+			return;
254
+		}
245 255
 		$ratingCounts = glsr( CountsManager::class )->flatten( $reviewCounts );
246 256
 		update_term_meta( $termId, static::META_COUNT, $reviewCounts );
247 257
 		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
@@ -259,7 +269,9 @@  discard block
 block discarded – undo
259 269
 		while( $reviews = $this->queryReviews( $args, $lastPostId, $limit )) {
260 270
 			$types = array_keys( array_flip( array_column( $reviews, 'type' )));
261 271
 			foreach( $types as $type ) {
262
-				if( isset( $counts[$type] ))continue;
272
+				if( isset( $counts[$type] )) {
273
+					continue;
274
+				}
263 275
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
264 276
 			}
265 277
 			foreach( $reviews as $review ) {
@@ -311,7 +323,9 @@  discard block
 block discarded – undo
311 323
 		}
312 324
 		foreach( $reviewCounts as &$counts ) {
313 325
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
314
-				if( isset( $counts[$index] ))continue;
326
+				if( isset( $counts[$index] )) {
327
+					continue;
328
+				}
315 329
 				$counts[$index] = 0;
316 330
 			}
317 331
 			ksort( $counts );
Please login to merge, or discard this patch.
plugin/Modules/Style.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@  discard block
 block discarded – undo
55 55
 		}
56 56
 		$views = $this->generatePossibleViews( $view );
57 57
 		foreach( $views as $possibleView ) {
58
-			if( !file_exists( glsr()->path( $possibleView.'.php' )))continue;
58
+			if( !file_exists( glsr()->path( $possibleView.'.php' ))) {
59
+				continue;
60
+			}
59 61
 			return $possibleView;
60 62
 		}
61 63
 		return $view;
@@ -88,7 +90,9 @@  discard block
 block discarded – undo
88 90
 	 */
89 91
 	public function modifyField( Builder $instance )
90 92
 	{
91
-		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return;
93
+		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields ))) {
94
+			return;
95
+		}
92 96
 		call_user_func_array( [$this, 'customize'], [&$instance] );
93 97
 	}
94 98
 
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
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 		$this->ratingCounts = glsr( CountsManager::class )->flatten( $counts, [
42 42
 			'min' => $args['rating'],
43 43
 		]);
44
-		if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ))return;
44
+		if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' )) {
45
+			return;
46
+		}
45 47
 		$this->averageRating = glsr( Rating::class )->getAverage( $this->ratingCounts );
46 48
 		$this->generateSchema();
47 49
 		return glsr( Template::class )->build( 'templates/reviews-summary', [
@@ -61,7 +63,9 @@  discard block
 block discarded – undo
61 63
 	 */
62 64
 	protected function buildPercentage()
63 65
 	{
64
-		if( $this->isHidden( 'bars' ))return;
66
+		if( $this->isHidden( 'bars' )) {
67
+			return;
68
+		}
65 69
 		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts ));
66 70
 		$bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use( $percentages ) {
67 71
 			$label = $this->buildPercentageLabel( $this->args['labels'][$level] );
@@ -110,7 +114,9 @@  discard block
 block discarded – undo
110 114
 	 */
111 115
 	protected function buildRating()
112 116
 	{
113
-		if( $this->isHidden( 'rating' ))return;
117
+		if( $this->isHidden( 'rating' )) {
118
+			return;
119
+		}
114 120
 		return $this->wrap( 'rating', '<span>'.$this->averageRating.'</span>' );
115 121
 	}
116 122
 
@@ -119,7 +125,9 @@  discard block
 block discarded – undo
119 125
 	 */
120 126
 	protected function buildStars()
121 127
 	{
122
-		if( $this->isHidden( 'stars' ))return;
128
+		if( $this->isHidden( 'stars' )) {
129
+			return;
130
+		}
123 131
 		$stars = glsr( Partial::class )->build( 'star-rating', ['rating' => $this->averageRating] );
124 132
 		return $this->wrap( 'stars', $stars );
125 133
 	}
@@ -129,7 +137,9 @@  discard block
 block discarded – undo
129 137
 	 */
130 138
 	protected function buildText()
131 139
 	{
132
-		if( $this->isHidden( 'summary' ))return;
140
+		if( $this->isHidden( 'summary' )) {
141
+			return;
142
+		}
133 143
 		$count = intval( array_sum( $this->ratingCounts ));
134 144
 		if( empty( $this->args['text'] )) {
135 145
 			// @todo document this change
@@ -154,7 +164,9 @@  discard block
 block discarded – undo
154 164
 	 */
155 165
 	protected function generateSchema()
156 166
 	{
157
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
167
+		if( !wp_validate_boolean( $this->args['schema'] )) {
168
+			return;
169
+		}
158 170
 		glsr( Schema::class )->store(
159 171
 			glsr( Schema::class )->buildSummary( $this->args )
160 172
 		);
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Pagination.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@
 block discarded – undo
20 20
 	public function build( array $args = [] )
21 21
 	{
22 22
 		$this->args = $this->normalize( $args );
23
-		if( $this->args['total'] < 2 )return;
23
+		if( $this->args['total'] < 2 ) {
24
+			return;
25
+		}
24 26
 		return glsr( Template::class )->build( 'templates/pagination', [
25 27
 			'context' => [
26 28
 				'links' => apply_filters( 'site-reviews/paginate_links', $this->buildLinks(), $this->args ),
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviews.php 1 patch
Braces   +39 added lines, -13 removed lines patch added patch discarded remove patch
@@ -85,7 +85,9 @@  discard block
 block discarded – undo
85 85
 		$renderedFields = [];
86 86
 		foreach( $review as $key => $value ) {
87 87
 			$method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' );
88
-			if( !method_exists( $this, $method ))continue;
88
+			if( !method_exists( $this, $method )) {
89
+				continue;
90
+			}
89 91
 			$renderedFields[$key] = $this->$method( $key, $value );
90 92
 		}
91 93
 		$renderedFields = apply_filters( 'site-reviews/review/build/after', (array)$renderedFields );
@@ -99,9 +101,13 @@  discard block
 block discarded – undo
99 101
 	 */
100 102
 	protected function buildOptionAssignedTo( $key, $value )
101 103
 	{
102
-		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return;
104
+		if( $this->isHidden( $key, 'settings.reviews.assigned_links' )) {
105
+			return;
106
+		}
103 107
 		$post = glsr( Polylang::class )->getPost( $value );
104
-		if( !( $post instanceof WP_Post ))return;
108
+		if( !( $post instanceof WP_Post )) {
109
+			return;
110
+		}
105 111
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
106 112
 			'href' => get_the_permalink( $post->ID ),
107 113
 		]);
@@ -116,7 +122,9 @@  discard block
 block discarded – undo
116 122
 	 */
117 123
 	protected function buildOptionAuthor( $key, $value )
118 124
 	{
119
-		if( $this->isHidden( $key ))return;
125
+		if( $this->isHidden( $key )) {
126
+			return;
127
+		}
120 128
 		return $this->wrap( $key, '<span>'.$value.'</span>' );
121 129
 	}
122 130
 
@@ -127,7 +135,9 @@  discard block
 block discarded – undo
127 135
 	 */
128 136
 	protected function buildOptionAvatar( $key, $value )
129 137
 	{
130
-		if( $this->isHidden( $key, 'settings.reviews.avatars' ))return;
138
+		if( $this->isHidden( $key, 'settings.reviews.avatars' )) {
139
+			return;
140
+		}
131 141
 		$size = $this->getOption( 'settings.reviews.avatars_size', 40 );
132 142
 		return $this->wrap( $key, glsr( Builder::class )->img([
133 143
 			'src' => $this->generateAvatar( $value ),
@@ -144,7 +154,9 @@  discard block
 block discarded – undo
144 154
 	protected function buildOptionContent( $key, $value )
145 155
 	{
146 156
 		$text = $this->normalizeText( $value );
147
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
157
+		if( $this->isHiddenOrEmpty( $key, $text )) {
158
+			return;
159
+		}
148 160
 		return $this->wrap( $key, '<p>'.$text.'</p>' );
149 161
 	}
150 162
 
@@ -155,7 +167,9 @@  discard block
 block discarded – undo
155 167
 	 */
156 168
 	protected function buildOptionDate( $key, $value )
157 169
 	{
158
-		if( $this->isHidden( $key ))return;
170
+		if( $this->isHidden( $key )) {
171
+			return;
172
+		}
159 173
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
160 174
 		if( $dateFormat == 'relative' ) {
161 175
 			$date = glsr( Date::class )->relative( $value );
@@ -176,7 +190,9 @@  discard block
 block discarded – undo
176 190
 	 */
177 191
 	protected function buildOptionRating( $key, $value )
178 192
 	{
179
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
193
+		if( $this->isHiddenOrEmpty( $key, $value )) {
194
+			return;
195
+		}
180 196
 		$rating = glsr( Partial::class )->build( 'star-rating', [
181 197
 			'rating' => $value,
182 198
 		]);
@@ -190,7 +206,9 @@  discard block
 block discarded – undo
190 206
 	 */
191 207
 	protected function buildOptionResponse( $key, $value )
192 208
 	{
193
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
209
+		if( $this->isHiddenOrEmpty( $key, $value )) {
210
+			return;
211
+		}
194 212
 		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
195 213
 		$text = $this->normalizeText( $value );
196 214
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
@@ -207,7 +225,9 @@  discard block
 block discarded – undo
207 225
 	 */
208 226
 	protected function buildOptionTitle( $key, $value )
209 227
 	{
210
-		if( $this->isHidden( $key ))return;
228
+		if( $this->isHidden( $key )) {
229
+			return;
230
+		}
211 231
 		if( empty( $value )) {
212 232
 			$value = __( 'No Title', 'site-reviews' );
213 233
 		}
@@ -239,7 +259,9 @@  discard block
 block discarded – undo
239 259
 	 */
240 260
 	protected function generateSchema()
241 261
 	{
242
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
262
+		if( !wp_validate_boolean( $this->args['schema'] )) {
263
+			return;
264
+		}
243 265
 		glsr( Schema::class )->store(
244 266
 			glsr( Schema::class )->build( $this->args )
245 267
 		);
@@ -289,9 +311,13 @@  discard block
 block discarded – undo
289 311
 		$words->setText( $text );
290 312
 		$count = 0;
291 313
 		foreach( $words as $offset ){
292
-			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
314
+			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE ) {
315
+				continue;
316
+			}
293 317
 			$count++;
294
-			if( $count != $limit )continue;
318
+			if( $count != $limit ) {
319
+				continue;
320
+			}
295 321
 			return $offset;
296 322
 		}
297 323
 		return strlen( $text );
Please login to merge, or discard this patch.
plugin/Handlers/CreateReview.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@
 block discarded – undo
22 22
 		}
23 23
 		glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ));
24 24
 		glsr( Notification::class )->send( $review );
25
-		if( $command->ajax_request )return;
25
+		if( $command->ajax_request ) {
26
+			return;
27
+		}
26 28
 		wp_safe_redirect( $this->getReferer( $command ));
27 29
 		exit;
28 30
 	}
Please login to merge, or discard this patch.