Passed
Push — hotfix/fix-counts ( 1ce239...9810ae )
by Paul
11:30 queued 06:23
created
plugin/Database/CountsManager.php 2 patches
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 )
@@ -249,7 +257,9 @@  discard block
 block discarded – undo
249 257
 	public function setTermCounts( $termId, array $reviewCounts )
250 258
 	{
251 259
 		$term = get_term( $termId, Application::TAXONOMY );
252
-		if( !isset( $term->term_id ))return;
260
+		if( !isset( $term->term_id )) {
261
+			return;
262
+		}
253 263
 		$ratingCounts = $this->flatten( $reviewCounts );
254 264
 		update_term_meta( $termId, static::META_COUNT, $reviewCounts );
255 265
 		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
@@ -270,7 +280,9 @@  discard block
 block discarded – undo
270 280
 			$types = array_unique( array_merge( ['local'], $types ));
271 281
 			foreach( $types as $type ) {
272 282
 				$type = $this->normalizeType( $type );
273
-				if( isset( $counts[$type] ))continue;
283
+				if( isset( $counts[$type] )) {
284
+					continue;
285
+				}
274 286
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
275 287
 			}
276 288
 			foreach( $reviews as $review ) {
@@ -323,7 +335,9 @@  discard block
 block discarded – undo
323 335
 		}
324 336
 		foreach( $reviewCounts as &$counts ) {
325 337
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
326
-				if( isset( $counts[$index] ))continue;
338
+				if( isset( $counts[$index] )) {
339
+					continue;
340
+				}
327 341
 				$counts[$index] = 0;
328 342
 			}
329 343
 			ksort( $counts );
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			$this->getCounts(),
65 65
 			$review->review_type,
66 66
 			$review->rating
67
-		));
67
+		) );
68 68
 	}
69 69
 
70 70
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function decreasePostCounts( Review $review )
74 74
 	{
75
-		if( empty( $counts = $this->getPostCounts( $review->assigned_to )))return;
75
+		if( empty($counts = $this->getPostCounts( $review->assigned_to )) )return;
76 76
 		$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
77 77
 		$this->setPostCounts( $review->assigned_to, $counts );
78 78
 	}
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	public function decreaseTermCounts( Review $review )
84 84
 	{
85 85
 		foreach( $review->term_ids as $termId ) {
86
-			if( empty( $counts = $this->getTermCounts( $termId )))continue;
86
+			if( empty($counts = $this->getTermCounts( $termId )) )continue;
87 87
 			$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
88 88
 			$this->setTermCounts( $termId, $counts );
89 89
 		}
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
 	public function flatten( array $reviewCounts, array $args = [] )
96 96
 	{
97 97
 		$counts = [];
98
-		array_walk_recursive( $reviewCounts, function( $num, $index ) use( &$counts ) {
99
-			$counts[$index] = $num + intval( glsr_get( $counts, $index, 0 ));
98
+		array_walk_recursive( $reviewCounts, function( $num, $index ) use(&$counts) {
99
+			$counts[$index] = $num + intval( glsr_get( $counts, $index, 0 ) );
100 100
 		});
101 101
 		$args = wp_parse_args( $args, [
102 102
 			'max' => Rating::MAX_RATING,
103 103
 			'min' => Rating::MIN_RATING,
104
-		]);
104
+		] );
105 105
 		foreach( $counts as $index => &$num ) {
106
-			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue;
106
+			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ) )continue;
107 107
 			$num = 0;
108 108
 		}
109 109
 		return $counts;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	{
117 117
 		$args = $this->normalizeArgs( $args );
118 118
 
119
-		if( !empty( $args['post_ids'] ) && !empty( $args['term_ids'] )) {
119
+		if( !empty($args['post_ids']) && !empty($args['term_ids']) ) {
120 120
 			$counts = [$this->build( $args )];
121 121
 		}
122 122
 		else {
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 				// @todo if multiple ids are provided, a query must be used!
131 131
 				$counts[] = $this->getTermCounts( $termId );
132 132
 			}
133
-			if( empty( $counts )) {
133
+			if( empty($counts) ) {
134 134
 				$counts[] = $this->getCounts();
135 135
 			}
136 136
 		}
137 137
 		return in_array( $args['type'], ['', 'all'] )
138 138
 			? $this->normalize( [$this->flatten( $counts )] )
139
-			: $this->normalize( glsr_array_column( $counts, $args['type'] ));
139
+			: $this->normalize( glsr_array_column( $counts, $args['type'] ) );
140 140
 	}
141 141
 
142 142
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	public function getCounts()
146 146
 	{
147 147
 		$counts = glsr( OptionManager::class )->get( 'counts', [] );
148
-		if( !is_array( $counts )) {
148
+		if( !is_array( $counts ) ) {
149 149
 			glsr_log()->error( '$counts is not an array' )->debug( $counts );
150 150
 			return [];
151 151
 		}
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function getPostCounts( $postId )
160 160
 	{
161
-		return array_filter( (array)get_post_meta( $postId, static::META_COUNT, true ));
161
+		return array_filter( (array)get_post_meta( $postId, static::META_COUNT, true ) );
162 162
 	}
163 163
 
164 164
 	/**
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public function getTermCounts( $termId )
169 169
 	{
170
-		return array_filter( (array)get_term_meta( $termId, static::META_COUNT, true ));
170
+		return array_filter( (array)get_term_meta( $termId, static::META_COUNT, true ) );
171 171
 	}
172 172
 
173 173
 	/**
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	public function increaseCounts( Review $review )
187 187
 	{
188
-		if( empty( $counts = $this->getCounts() )) {
188
+		if( empty($counts = $this->getCounts()) ) {
189 189
 			$counts = $this->buildCounts();
190 190
 		}
191
-		$this->setCounts( $this->increaseRating( $counts, $review->review_type, $review->rating ));
191
+		$this->setCounts( $this->increaseRating( $counts, $review->review_type, $review->rating ) );
192 192
 	}
193 193
 
194 194
 	/**
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	public function increasePostCounts( Review $review )
198 198
 	{
199
-		if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return;
199
+		if( !(get_post( $review->assigned_to ) instanceof WP_Post) )return;
200 200
 		$counts = $this->getPostCounts( $review->assigned_to );
201
-		$counts = empty( $counts )
201
+		$counts = empty($counts)
202 202
 			? $this->buildPostCounts( $review->assigned_to )
203 203
 			: $this->increaseRating( $counts, $review->review_type, $review->rating );
204 204
 		$this->setPostCounts( $review->assigned_to, $counts );
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	public function increaseTermCounts( Review $review )
211 211
 	{
212
-		$terms = glsr( ReviewManager::class )->normalizeTerms( implode( ',', $review->term_ids ));
212
+		$terms = glsr( ReviewManager::class )->normalizeTerms( implode( ',', $review->term_ids ) );
213 213
 		foreach( $terms as $term ) {
214 214
 			$counts = $this->getTermCounts( $term['term_id'] );
215
-			$counts = empty( $counts )
215
+			$counts = empty($counts)
216 216
 				? $this->buildTermCounts( $term['term_taxonomy_id'] )
217 217
 				: $this->increaseRating( $counts, $review->review_type, $review->rating );
218 218
 			$this->setTermCounts( $term['term_id'], $counts );
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	{
236 236
 		$ratingCounts = $this->flatten( $reviewCounts );
237 237
 		update_post_meta( $postId, static::META_COUNT, $reviewCounts );
238
-		update_post_meta( $postId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
239
-		update_post_meta( $postId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ));
238
+		update_post_meta( $postId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ) );
239
+		update_post_meta( $postId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ) );
240 240
 	}
241 241
 
242 242
 	/**
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
 	public function setTermCounts( $termId, array $reviewCounts )
247 247
 	{
248 248
 		$term = get_term( $termId, Application::TAXONOMY );
249
-		if( !isset( $term->term_id ))return;
249
+		if( !isset($term->term_id) )return;
250 250
 		$ratingCounts = $this->flatten( $reviewCounts );
251 251
 		update_term_meta( $termId, static::META_COUNT, $reviewCounts );
252
-		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
253
-		update_term_meta( $termId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ));
252
+		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ) );
253
+		update_term_meta( $termId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ) );
254 254
 	}
255 255
 
256 256
 	/**
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
 	{
263 263
 		$counts = [];
264 264
 		$lastPostId = 0;
265
-		while( $reviews = $this->queryReviews( $args, $lastPostId )) {
266
-			$types = array_keys( array_flip( glsr_array_column( $reviews, 'type' )));
267
-			$types = array_unique( array_merge( ['local'], $types ));
265
+		while( $reviews = $this->queryReviews( $args, $lastPostId ) ) {
266
+			$types = array_keys( array_flip( glsr_array_column( $reviews, 'type' ) ) );
267
+			$types = array_unique( array_merge( ['local'], $types ) );
268 268
 			foreach( $types as $type ) {
269 269
 				$type = $this->normalizeType( $type );
270
-				if( isset( $counts[$type] ))continue;
270
+				if( isset($counts[$type]) )continue;
271 271
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
272 272
 			}
273 273
 			foreach( $reviews as $review ) {
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	protected function decreaseRating( array $reviewCounts, $type, $rating )
288 288
 	{
289
-		if( isset( $reviewCounts[$type][$rating] )) {
289
+		if( isset($reviewCounts[$type][$rating]) ) {
290 290
 			$reviewCounts[$type][$rating] = max( 0, $reviewCounts[$type][$rating] - 1 );
291 291
 		}
292 292
 		return $reviewCounts;
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
 	 */
300 300
 	protected function increaseRating( array $reviewCounts, $type, $rating )
301 301
 	{
302
-		if( !array_key_exists( $type, glsr()->reviewTypes )) {
302
+		if( !array_key_exists( $type, glsr()->reviewTypes ) ) {
303 303
 			return $reviewCounts;
304 304
 		}
305
-		if( !array_key_exists( $type, $reviewCounts )) {
305
+		if( !array_key_exists( $type, $reviewCounts ) ) {
306 306
 			$reviewCounts[$type] = [];
307 307
 		}
308 308
 		$reviewCounts = $this->normalize( $reviewCounts );
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	protected function normalize( array $reviewCounts )
317 317
 	{
318
-		if( empty( $reviewCounts )) {
318
+		if( empty($reviewCounts) ) {
319 319
 			$reviewCounts = [[]];
320 320
 		}
321 321
 		foreach( $reviewCounts as &$counts ) {
322 322
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
323
-				if( isset( $counts[$index] ))continue;
323
+				if( isset($counts[$index]) )continue;
324 324
 				$counts[$index] = 0;
325 325
 			}
326 326
 			ksort( $counts );
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 			'post_ids' => [],
338 338
 			'term_ids' => [],
339 339
 			'type' => 'local',
340
-		]);
340
+		] );
341 341
 		$args['post_ids'] = glsr( Polylang::class )->getPostIds( $args['post_ids'] );
342 342
 		$args['type'] = $this->normalizeType( $args['type'] );
343 343
 		return $args;
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	 */
350 350
 	protected function normalizeType( $type )
351 351
 	{
352
-		return empty( $type ) || !is_string( $type )
352
+		return empty($type) || !is_string( $type )
353 353
 			? 'local'
354 354
 			: $type;
355 355
 	}
Please login to merge, or discard this patch.
plugin/Database.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 		if( empty( $assignedTo )) {
24 24
 			$assignedTo = get_post_meta( $postId, 'assigned_to', true );
25 25
 		}
26
-		if( empty( $assignedTo ))return;
26
+		if( empty( $assignedTo )) {
27
+			return;
28
+		}
27 29
 		$assignedPost = get_post( $assignedTo );
28 30
 		if( $assignedPost instanceof WP_Post && $assignedPost->ID != $postId ) {
29 31
 			return $assignedPost;
@@ -80,7 +82,9 @@  discard block
 block discarded – undo
80 82
 		$termIds = [];
81 83
 		foreach( $values as $value ) {
82 84
 			$term = get_term_by( $field, $value, Application::TAXONOMY );
83
-			if( !isset( $term->term_id ))continue;
85
+			if( !isset( $term->term_id )) {
86
+				continue;
87
+			}
84 88
 			$termIds[] = $term->term_id;
85 89
 		}
86 90
 		return $termIds;
@@ -127,7 +131,9 @@  discard block
 block discarded – undo
127 131
 		add_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2 );
128 132
 		$search = new WP_Query( $args );
129 133
 		remove_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500 );
130
-		if( !$search->have_posts() )return;
134
+		if( !$search->have_posts() ) {
135
+			return;
136
+		}
131 137
 		$results = '';
132 138
 		while( $search->have_posts() ) {
133 139
 			$search->the_post();
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	public function getAssignedToPost( $postId, $assignedTo = '' )
22 22
 	{
23
-		if( empty( $assignedTo )) {
23
+		if( empty($assignedTo) ) {
24 24
 			$assignedTo = get_post_meta( $postId, 'assigned_to', true );
25 25
 		}
26
-		if( empty( $assignedTo ))return;
26
+		if( empty($assignedTo) )return;
27 27
 		$assignedPost = get_post( $assignedTo );
28 28
 		if( $assignedPost instanceof WP_Post && $assignedPost->ID != $postId ) {
29 29
 			return $assignedPost;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function getReviewsMeta( $key, $status = 'publish' )
65 65
 	{
66
-		if( $status == 'all' || empty( $status )) {
66
+		if( $status == 'all' || empty($status) ) {
67 67
 			$status = get_post_stati( ['exclude_from_search' => false] );
68 68
 		}
69 69
 		return glsr( SqlQueries::class )->getReviewsMeta( $key, $status );
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		$termIds = [];
79 79
 		foreach( $values as $value ) {
80 80
 			$term = get_term_by( $field, $value, Application::TAXONOMY );
81
-			if( !isset( $term->term_id ))continue;
81
+			if( !isset($term->term_id) )continue;
82 82
 			$termIds[] = $term->term_id;
83 83
 		}
84 84
 		return $termIds;
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 			'fields' => 'id=>name',
95 95
 			'hide_empty' => false,
96 96
 			'taxonomy' => Application::TAXONOMY,
97
-		]);
97
+		] );
98 98
 		$terms = get_terms( $args );
99
-		if( is_wp_error( $terms )) {
99
+		if( is_wp_error( $terms ) ) {
100 100
 			glsr_log()->error( $terms->get_error_message() );
101 101
 			return [];
102 102
 		}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			'post_status' => 'publish',
114 114
 			'post_type' => 'any',
115 115
 		];
116
-		if( is_numeric( $searchTerm )) {
116
+		if( is_numeric( $searchTerm ) ) {
117 117
 			$args['post__in'] = [$searchTerm];
118 118
 		}
119 119
 		else {
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 			ob_start();
133 133
 			glsr()->render( 'partials/editor/search-result', [
134 134
 				'ID' => get_the_ID(),
135
-				'permalink' => esc_url( (string) get_permalink() ),
135
+				'permalink' => esc_url( (string)get_permalink() ),
136 136
 				'title' => esc_attr( get_the_title() ),
137
-			]);
137
+			] );
138 138
 			$results .= ob_get_clean();
139 139
 		}
140 140
 		wp_reset_postdata();
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsSummaryShortcode.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,8 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsSummaryShortcode extends Shortcode
8 8
 {
9
-	protected function hideOptions() {
9
+	protected function hideOptions()
10
+	{
10 11
 		return [
11 12
 			'rating' => __( 'Hide the rating', 'site-reviews' ),
12 13
 			'stars' => __( 'Hide the stars', 'site-reviews' ),
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsShortcode.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,8 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsShortcode extends Shortcode
8 8
 {
9
-	protected function hideOptions() {
9
+	protected function hideOptions()
10
+	{
10 11
 		return [
11 12
 			'title' => __( 'Hide the title', 'site-reviews' ),
12 13
 			'rating' => __( 'Hide the rating', 'site-reviews' ),
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsFormPopup.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 		return [[
16 16
 			'type' => 'container',
17 17
 			'html' => '<p class="strong">'.esc_html__( 'All settings are optional.', 'site-reviews' ).'</p>',
18
-		],[
18
+		], [
19 19
 			'label' => esc_html__( 'Title', 'site-reviews' ),
20 20
 			'name' => 'title',
21 21
 			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
22 22
 			'type' => 'textbox',
23
-		],[
23
+		], [
24 24
 			'label' => esc_html__( 'Description', 'site-reviews' ),
25 25
 			'minHeight' => 60,
26 26
 			'minWidth' => 240,
@@ -29,25 +29,25 @@  discard block
 block discarded – undo
29 29
 			'tooltip' => __( 'Enter a custom shortcode description.', 'site-reviews' ),
30 30
 			'type' => 'textbox',
31 31
 		],
32
-		$this->getCategories( __( 'Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews' )),
32
+		$this->getCategories( __( 'Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews' ) ),
33 33
 		[
34 34
 			'label' => esc_html__( 'Assign To', 'site-reviews' ),
35 35
 			'name' => 'assign_to',
36 36
 			'tooltip' => __( 'Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews' ),
37 37
 			'type' => 'textbox',
38
-		],[
38
+		], [
39 39
 			'label' => esc_html__( 'Classes', 'site-reviews' ),
40 40
 			'name' => 'class',
41 41
 			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
42 42
 			'type' => 'textbox',
43
-		],[
43
+		], [
44 44
 			'columns' => 2,
45 45
 			'items' => $this->getHideOptions(),
46 46
 			'label' => esc_html__( 'Hide', 'site-reviews' ),
47 47
 			'layout' => 'grid',
48 48
 			'spacing' => 5,
49 49
 			'type' => 'container',
50
-		],[
50
+		], [
51 51
 			'hidden' => true,
52 52
 			'name' => 'id',
53 53
 			'type' => 'textbox',
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsWidget.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
 			'class' => 'widefat',
21 21
 			'label' => __( 'Title', 'site-reviews' ),
22 22
 			'name' => 'title',
23
-		]);
23
+		] );
24 24
 		$this->renderField( 'number', [
25 25
 			'class' => 'small-text',
26 26
 			'default' => 5,
27 27
 			'label' => __( 'How many reviews would you like to display?', 'site-reviews' ),
28 28
 			'max' => 100,
29 29
 			'name' => 'count',
30
-		]);
30
+		] );
31 31
 		$this->renderField( 'select', [
32 32
 			'label' => __( 'What is the minimum rating to display?', 'site-reviews' ),
33 33
 			'name' => 'rating',
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 				'2' => sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ),
39 39
 				'1' => sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ),
40 40
 			],
41
-		]);
41
+		] );
42 42
 		if( count( glsr()->reviewTypes ) > 1 ) {
43 43
 			$this->renderField( 'select', [
44 44
 				'class' => 'widefat',
45 45
 				'label' => __( 'Which type of review would you like to display?', 'site-reviews' ),
46 46
 				'name' => 'type',
47 47
 				'options' => ['' => __( 'All Reviews', 'site-reviews' )] + glsr()->reviewTypes,
48
-			]);
48
+			] );
49 49
 		}
50
-		if( !empty( $terms )) {
50
+		if( !empty($terms) ) {
51 51
 			$this->renderField( 'select', [
52 52
 				'class' => 'widefat',
53 53
 				'label' => __( 'Limit reviews to this category', 'site-reviews' ),
54 54
 				'name' => 'category',
55 55
 				'options' => ['' => __( 'All Categories', 'site-reviews' )] + $terms,
56
-			]);
56
+			] );
57 57
 		}
58 58
 		$this->renderField( 'text', [
59 59
 			'class' => 'widefat',
@@ -61,16 +61,16 @@  discard block
 block discarded – undo
61 61
 			'description' => sprintf( __( "Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews' ), '<code>post_id</code>' ),
62 62
 			'label' => __( 'Limit reviews to those assigned to this page/post ID', 'site-reviews' ),
63 63
 			'name' => 'assigned_to',
64
-		]);
64
+		] );
65 65
 		$this->renderField( 'text', [
66 66
 			'class' => 'widefat',
67 67
 			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
68 68
 			'name' => 'class',
69
-		]);
69
+		] );
70 70
 		$this->renderField( 'checkbox', [
71 71
 			'name' => 'hide',
72 72
 			'options' => glsr( SiteReviewsShortcode::class )->getHideOptions(),
73
-		]);
73
+		] );
74 74
 	}
75 75
 
76 76
 	/**
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function update( $newInstance, $oldInstance )
82 82
 	{
83
-		if( !is_numeric( $newInstance['count'] )) {
83
+		if( !is_numeric( $newInstance['count'] ) ) {
84 84
 			$newInstance['count'] = 10;
85 85
 		}
86
-		$newInstance['count'] = min( 50, max( 0, intval( $newInstance['count'] )));
86
+		$newInstance['count'] = min( 50, max( 0, intval( $newInstance['count'] ) ) );
87 87
 		return parent::update( $newInstance, $oldInstance );
88 88
 	}
89 89
 
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsFormWidget.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,34 +20,34 @@
 block discarded – undo
20 20
 			'class' => 'widefat',
21 21
 			'label' => __( 'Title', 'site-reviews' ),
22 22
 			'name' => 'title',
23
-		]);
23
+		] );
24 24
 		$this->renderField( 'textarea', [
25 25
 			'class' => 'widefat',
26 26
 			'label' => __( 'Description', 'site-reviews' ),
27 27
 			'name' => 'description',
28
-		]);
28
+		] );
29 29
 		$this->renderField( 'select', [
30 30
 			'class' => 'widefat',
31 31
 			'label' => __( 'Automatically assign a category', 'site-reviews' ),
32 32
 			'name' => 'category',
33 33
 			'options' => ['' => __( 'Do not assign a category', 'site-reviews' )] + $terms,
34
-		]);
34
+		] );
35 35
 		$this->renderField( 'text', [
36 36
 			'class' => 'widefat',
37 37
 			'default' => '',
38 38
 			'description' => sprintf( __( 'You may also enter %s to assign to the current post.', 'site-reviews' ), '<code>post_id</code>' ),
39 39
 			'label' => __( 'Assign reviews to a custom page/post ID', 'site-reviews' ),
40 40
 			'name' => 'assign_to',
41
-		]);
41
+		] );
42 42
 		$this->renderField( 'text', [
43 43
 			'class' => 'widefat',
44 44
 			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
45 45
 			'name' => 'class',
46
-		]);
46
+		] );
47 47
 		$this->renderField( 'checkbox', [
48 48
 			'name' => 'hide',
49 49
 			'options' => glsr( SiteReviewsFormShortcode::class )->getHideOptions(),
50
-		]);
50
+		] );
51 51
 	}
52 52
 
53 53
 	/**
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsSummaryWidget.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,22 +20,22 @@  discard block
 block discarded – undo
20 20
 			'class' => 'widefat',
21 21
 			'label' => __( 'Title', 'site-reviews' ),
22 22
 			'name' => 'title',
23
-		]);
23
+		] );
24 24
 		if( count( glsr()->reviewTypes ) > 1 ) {
25 25
 			$this->renderField( 'select', [
26 26
 				'class' => 'widefat',
27 27
 				'label' => __( 'Which type of review would you like to use?', 'site-reviews' ),
28 28
 				'name' => 'type',
29 29
 				'options' => ['' => __( 'All review types', 'site-reviews' )] + glsr()->reviewTypes,
30
-			]);
30
+			] );
31 31
 		}
32
-		if( !empty( $terms )) {
32
+		if( !empty($terms) ) {
33 33
 			$this->renderField( 'select', [
34 34
 				'class' => 'widefat',
35 35
 				'label' => __( 'Limit summary to this category', 'site-reviews' ),
36 36
 				'name' => 'category',
37 37
 				'options' => ['' => __( 'All Categories', 'site-reviews' )] + $terms,
38
-			]);
38
+			] );
39 39
 		}
40 40
 		$this->renderField( 'text', [
41 41
 			'class' => 'widefat',
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 			'description' => sprintf( __( "Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews' ), '<code>post_id</code>' ),
44 44
 			'label' => __( 'Limit summary to reviews assigned to a page/post ID', 'site-reviews' ),
45 45
 			'name' => 'assigned_to',
46
-		]);
46
+		] );
47 47
 		$this->renderField( 'text', [
48 48
 			'class' => 'widefat',
49 49
 			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
50 50
 			'name' => 'class',
51
-		]);
51
+		] );
52 52
 		$this->renderField( 'checkbox', [
53 53
 			'name' => 'hide',
54 54
 			'options' => glsr( SiteReviewsSummaryShortcode::class )->getHideOptions(),
55
-		]);
55
+		] );
56 56
 	}
57 57
 
58 58
 	/**
Please login to merge, or discard this patch.
plugin/Modules/Slack.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function compose( Review $review, array $notification )
37 37
 	{
38
-		if( empty( $this->endpoint )) {
38
+		if( empty($this->endpoint) ) {
39 39
 			return $this;
40 40
 		}
41 41
 		$args = shortcode_atts( glsr( SlackDefaults::class )->defaults(), $notification );
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function send()
62 62
 	{
63
-		if( empty( $this->endpoint )) {
63
+		if( empty($this->endpoint) ) {
64 64
 			return new WP_Error( 'slack', 'Slack notification was not sent: missing endpoint' );
65 65
 		}
66 66
 		return wp_remote_post( $this->endpoint, [
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			'redirection' => 5,
73 73
 			'sslverify' => false,
74 74
 			'timeout' => 45,
75
-		]);
75
+		] );
76 76
 	}
77 77
 
78 78
 	/**
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	protected function buildAuthorField()
94 94
 	{
95
-		$email = !empty( $this->review->email )
95
+		$email = !empty($this->review->email)
96 96
 			? '<'.$this->review->email.'>'
97 97
 			: '';
98 98
 		$author = trim( rtrim( $this->review->author ).' '.$email );
99
-		return ['value' => implode( ' - ', array_filter( [$author, $this->review->ip_address] ))];
99
+		return ['value' => implode( ' - ', array_filter( [$author, $this->review->ip_address] ) )];
100 100
 	}
101 101
 
102 102
 	/**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	protected function buildContentField()
106 106
 	{
107
-		return !empty( $this->review->content )
107
+		return !empty($this->review->content)
108 108
 			? ['value' => $this->review->content]
109 109
 			: [];
110 110
 	}
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	protected function buildStarsField()
130 130
 	{
131 131
 		$solidStars = str_repeat( '★', $this->review->rating );
132
-		$emptyStars = str_repeat( '☆', max( 0, Rating::MAX_RATING - $this->review->rating ));
132
+		$emptyStars = str_repeat( '☆', max( 0, Rating::MAX_RATING - $this->review->rating ) );
133 133
 		$stars = $solidStars.$emptyStars;
134 134
 		$stars = apply_filters( 'site-reviews/slack/stars', $stars, $this->review->rating, Rating::MAX_RATING );
135 135
 		return ['title' => $stars];
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	protected function buildTitleField()
142 142
 	{
143
-		return !empty( $this->review->title )
143
+		return !empty($this->review->title)
144 144
 			? ['title' => $this->review->title]
145 145
 			: [];
146 146
 	}
Please login to merge, or discard this patch.