Passed
Push — master ( 211fe0...c1039b )
by Paul
03:43
created
plugin/Modules/Style.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 			'templates/form/submit-button',
38 38
 			'templates/reviews-form',
39 39
 		];
40
-		if( !preg_match( '('.implode( '|', $styledViews ).')', $view )) {
40
+		if( !preg_match( '('.implode( '|', $styledViews ).')', $view ) ) {
41 41
 			return $view;
42 42
 		}
43 43
 		$views = $this->generatePossibleViews( $view );
44 44
 		foreach( $views as $possibleView ) {
45
-			if( !file_exists( glsr()->path( 'views/'.$possibleView.'.php' )))continue;
45
+			if( !file_exists( glsr()->path( 'views/'.$possibleView.'.php' ) ) )continue;
46 46
 			return $possibleView;
47 47
 		}
48 48
 		return $view;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function modifyField( Builder $instance )
78 78
 	{
79
-		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->styles )))return;
79
+		if( !$this->isPublicInstance( $instance ) || empty(array_filter( $this->styles )) )return;
80 80
 		call_user_func_array( [$this, 'customize'], [&$instance] );
81 81
 	}
82 82
 
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	protected function customize( Builder $instance )
87 87
 	{
88
-		$args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ));
88
+		$args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ) );
89 89
 		$key = $instance->tag.'_'.$args['type'];
90
-		$classes = !isset( $this->styles[$key] )
90
+		$classes = !isset($this->styles[$key])
91 91
 			? $this->styles[$instance->tag]
92 92
 			: $this->styles[$key];
93 93
 		$instance->args['class'] = trim( $args['class'].' '.$classes );
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		$args = wp_parse_args( $instance->args, [
122 122
 			'is_public' => false,
123 123
 			'is_raw' => false,
124
-		]);
124
+		] );
125 125
 		if( is_admin() || !$args['is_public'] || $args['is_raw'] ) {
126 126
 			return false;
127 127
 		}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 		}
43 43
 		$views = $this->generatePossibleViews( $view );
44 44
 		foreach( $views as $possibleView ) {
45
-			if( !file_exists( glsr()->path( 'views/'.$possibleView.'.php' )))continue;
45
+			if( !file_exists( glsr()->path( 'views/'.$possibleView.'.php' ))) {
46
+				continue;
47
+			}
46 48
 			return $possibleView;
47 49
 		}
48 50
 		return $view;
@@ -76,7 +78,9 @@  discard block
 block discarded – undo
76 78
 	 */
77 79
 	public function modifyField( Builder $instance )
78 80
 	{
79
-		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->styles )))return;
81
+		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->styles ))) {
82
+			return;
83
+		}
80 84
 		call_user_func_array( [$this, 'customize'], [&$instance] );
81 85
 	}
82 86
 
Please login to merge, or discard this patch.
compatibility.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  */
10 10
 add_filter( 'sbp_exclude_defer_scripts', function( $scriptHandles ) {
11 11
 	$scriptHandles[] = 'site-reviews/google-recaptcha';
12
-	return array_keys( array_flip( $scriptHandles ));
12
+	return array_keys( array_flip( $scriptHandles ) );
13 13
 });
14 14
 
15 15
 /**
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,6 +17,8 @@
 block discarded – undo
17 17
  * @return void
18 18
  */
19 19
 add_action( 'site-reviews/customize/divi', function( $instance ) {
20
-	if( $instance->tag != 'label' || $instance->args['type'] != 'checkbox' )return;
20
+	if( $instance->tag != 'label' || $instance->args['type'] != 'checkbox' ) {
21
+		return;
22
+	}
21 23
 	$instance->args['text'] = '<i></i>'.$instance->args['text'];
22 24
 });
Please login to merge, or discard this patch.
plugin/Review.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 			'review_type' => '',
63 63
 		];
64 64
 		$meta = array_filter(
65
-			array_map( 'array_shift', (array)get_post_meta( $post->ID )),
65
+			array_map( 'array_shift', (array)get_post_meta( $post->ID ) ),
66 66
 			'strlen'
67 67
 		);
68
-		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
68
+		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) );
69 69
 		$this->modified = $this->isModified( $properties );
70 70
 		array_walk( $properties, function( $value, $key ) {
71
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
71
+			if( !property_exists( $this, $key ) || isset($this->$key) )return;
72 72
 			$this->$key = $value;
73 73
 		});
74 74
 	}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	protected function setTermIds( WP_Post $post )
80 80
 	{
81 81
 		$this->term_ids = [];
82
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
82
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return;
83 83
 		foreach( $terms as $term ) {
84 84
 			$this->term_ids[] = $term->term_id;
85 85
 		}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,9 @@  discard block
 block discarded – undo
68 68
 		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
69 69
 		$this->modified = $this->isModified( $properties );
70 70
 		array_walk( $properties, function( $value, $key ) {
71
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
71
+			if( !property_exists( $this, $key ) || isset( $this->$key )) {
72
+				return;
73
+			}
72 74
 			$this->$key = $value;
73 75
 		});
74 76
 	}
@@ -79,7 +81,9 @@  discard block
 block discarded – undo
79 81
 	protected function setTermIds( WP_Post $post )
80 82
 	{
81 83
 		$this->term_ids = [];
82
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
84
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ))) {
85
+			return;
86
+		}
83 87
 		foreach( $terms as $term ) {
84 88
 			$this->term_ids[] = $term->term_id;
85 89
 		}
Please login to merge, or discard this patch.
plugin/Modules/Upgrader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 		natsort( $routines );
18 18
 		array_walk( $routines, function( $routine ) {
19 19
 			$parts = explode( '__', $routine );
20
-			if( version_compare( glsr()->version, end( $parts ), '<' ))return;
20
+			if( version_compare( glsr()->version, end( $parts ), '<' ) )return;
21 21
 			call_user_func( [$this, $routine] );
22 22
 		});
23 23
 		$this->updateVersion();
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	public function updateVersion()
30 30
 	{
31 31
 		$currentVersion = glsr( OptionManager::class )->get( 'version' );
32
-		if( version_compare( $currentVersion, glsr()->version, '<' )) {
32
+		if( version_compare( $currentVersion, glsr()->version, '<' ) ) {
33 33
 			glsr( OptionManager::class )->set( 'version', glsr()->version );
34 34
 		}
35 35
 		if( $currentVersion != glsr()->version ) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 		natsort( $routines );
18 18
 		array_walk( $routines, function( $routine ) {
19 19
 			$parts = explode( '__', $routine );
20
-			if( version_compare( glsr()->version, end( $parts ), '<' ))return;
20
+			if( version_compare( glsr()->version, end( $parts ), '<' )) {
21
+				return;
22
+			}
21 23
 			call_user_func( [$this, $routine] );
22 24
 		});
23 25
 		$this->updateVersion();
Please login to merge, or discard this patch.
plugin/Modules/Schema.php 2 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 			if( $review->review_type != 'local' )continue;
44 44
 			$reviews[] = $this->buildReview( $review );
45 45
 		}
46
-		if( !empty( $reviews )) {
46
+		if( !empty($reviews) ) {
47 47
 			array_walk( $reviews, function( &$review ) {
48
-				unset( $review['@context'] );
49
-				unset( $review['itemReviewed'] );
48
+				unset($review['@context']);
49
+				unset($review['itemReviewed']);
50 50
 			});
51 51
 			$schema['review'] = $reviews;
52 52
 		}
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function buildSummary( $args = null )
61 61
 	{
62
-		if( is_array( $args )) {
62
+		if( is_array( $args ) ) {
63 63
 			$this->args = $args;
64 64
 		}
65 65
 		$buildSummary = glsr( Helper::class )->buildMethodName( $this->getSchemaOptionValue( 'type' ), 'buildSummaryFor' );
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$schema = method_exists( $this, $buildSummary )
68 68
 			? $this->$buildSummary()
69 69
 			: $this->buildSummaryForCustom();
70
-		if( !empty( $count )) {
70
+		if( !empty($count) ) {
71 71
 			$schema->aggregateRating(
72 72
 				$this->getSchemaType( 'AggregateRating' )
73 73
 					->ratingValue( $this->getRatingValue() )
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function render()
87 87
 	{
88
-		if( is_null( glsr()->schemas ))return;
88
+		if( is_null( glsr()->schemas ) )return;
89 89
 		printf( '<script type="application/ld+json">%s</script>', json_encode(
90 90
 			apply_filters( 'site-reviews/schema/all', glsr()->schemas ),
91 91
 			JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
92
-		));
92
+		) );
93 93
 	}
94 94
 
95 95
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	{
100 100
 		$schemas = glsr()->schemas;
101 101
 		$schemas[] = $schema;
102
-		glsr()->schemas = array_map( 'unserialize', array_unique( array_map( 'serialize', $schemas )));
102
+		glsr()->schemas = array_map( 'unserialize', array_unique( array_map( 'serialize', $schemas ) ) );
103 103
 	}
104 104
 
105 105
 	/**
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 	protected function buildReview( $review )
110 110
 	{
111 111
 		$schema = $this->getSchemaType( 'Review' )
112
-			->doIf( !in_array( 'title', $this->args['hide'] ), function( $schema ) use( $review ) {
112
+			->doIf( !in_array( 'title', $this->args['hide'] ), function( $schema ) use($review) {
113 113
 				$schema->name( $review->title );
114 114
 			})
115
-			->doIf( !in_array( 'excerpt', $this->args['hide'] ), function( $schema ) use( $review ) {
115
+			->doIf( !in_array( 'excerpt', $this->args['hide'] ), function( $schema ) use($review) {
116 116
 				$schema->reviewBody( $review->content );
117 117
 			})
118
-			->datePublished(( new DateTime( $review->date )))
119
-			->author( $this->getSchemaType( 'Person' )->name( $review->author ))
120
-			->itemReviewed( $this->getSchemaType()->name( $this->getSchemaOptionValue( 'name' )));
121
-		if( !empty( $review->rating )) {
118
+			->datePublished( (new DateTime( $review->date )) )
119
+			->author( $this->getSchemaType( 'Person' )->name( $review->author ) )
120
+			->itemReviewed( $this->getSchemaType()->name( $this->getSchemaOptionValue( 'name' ) ) );
121
+		if( !empty($review->rating) ) {
122 122
 			$schema->reviewRating(
123 123
 				$this->getSchemaType( 'Rating' )
124 124
 					->ratingValue( $review->rating )
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	{
138 138
 		foreach( $values as $value ) {
139 139
 			$option = $this->getSchemaOptionValue( $value );
140
-			if( empty( $option ))continue;
140
+			if( empty($option) )continue;
141 141
 			$schema->$value( $option );
142 142
 		}
143 143
 		return $schema;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	{
151 151
 		return $this->buildSchemaValues( $this->getSchemaType(), [
152 152
 			'description', 'image', 'name', 'url',
153
-		]);
153
+		] );
154 154
 	}
155 155
 
156 156
 	/**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	{
161 161
 		return $this->buildSchemaValues( $this->buildSummaryForCustom(), [
162 162
 			'address', 'priceRange', 'telephone',
163
-		]);
163
+		] );
164 164
 	}
165 165
 
166 166
 	/**
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 	{
171 171
 		$offers = $this->buildSchemaValues( $this->getSchemaType( 'AggregateOffer' ), [
172 172
 			'highPrice', 'lowPrice', 'priceCurrency',
173
-		]);
173
+		] );
174 174
 		return $this->buildSummaryForCustom()
175 175
 			->offers( $offers )
176
-			->setProperty( '@id', $this->getSchemaOptionValue( 'url' ));
176
+			->setProperty( '@id', $this->getSchemaOptionValue( 'url' ) );
177 177
 	}
178 178
 
179 179
 	/**
@@ -181,16 +181,16 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	protected function getRatingCounts()
183 183
 	{
184
-		if( !isset( $this->ratingCounts )) {
184
+		if( !isset($this->ratingCounts) ) {
185 185
 			$this->setPostCounts();
186 186
 			$this->setTermCounts();
187
-			if( empty( $this->reviewCounts )) {
187
+			if( empty($this->reviewCounts) ) {
188 188
 				$this->reviewCounts = glsr( CountsManager::class )->getCounts();
189 189
 			}
190 190
 			$counts = array_column( $this->reviewCounts, 'local' );
191 191
 			$this->ratingCounts = glsr( CountsManager::class )->flatten( $counts, [
192 192
 				'min' => $this->args['rating'],
193
-			]);
193
+			] );
194 194
 		}
195 195
 		return $this->ratingCounts;
196 196
 	}
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 	protected function getSchemaOption( $option, $fallback )
212 212
 	{
213 213
 		$option = strtolower( $option );
214
-		if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ))) {
214
+		if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ) ) ) {
215 215
 			return $schemaOption;
216 216
 		}
217 217
 		$setting = glsr( OptionManager::class )->get( 'settings.schema.'.$option );
218
-		if( is_array( $setting )) {
218
+		if( is_array( $setting ) ) {
219 219
 			return $this->getSchemaOptionDefault( $setting, $fallback );
220 220
 		}
221
-		return !empty( $setting )
221
+		return !empty($setting)
222 222
 			? $setting
223 223
 			: $fallback;
224 224
 	}
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		$setting = wp_parse_args( $setting, [
233 233
 			'custom' => '',
234 234
 			'default' => $fallback,
235
-		]);
235
+		] );
236 236
 		return $setting['default'] != 'custom'
237 237
 			? $setting['default']
238 238
 			: $setting['custom'];
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 		}
252 252
 		if( !is_single() && !is_page() )return;
253 253
 		$method = glsr( Helper::class )->buildMethodName( $option, 'getThing' );
254
-		if( method_exists( $this, $method )) {
254
+		if( method_exists( $this, $method ) ) {
255 255
 			return $this->$method();
256 256
 		}
257 257
 	}
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	protected function getSchemaType( $type = null )
264 264
 	{
265
-		if( !is_string( $type )) {
265
+		if( !is_string( $type ) ) {
266 266
 			$type = $this->getSchemaOption( 'type', 'LocalBusiness' );
267 267
 		}
268 268
 		$className = glsr( Helper::class )->buildClassName( $type, 'Modules\Schema' );
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 	protected function getThingDescription()
278 278
 	{
279 279
 		$post = get_post();
280
-		if( !( $post instanceof WP_Post )) {
280
+		if( !($post instanceof WP_Post) ) {
281 281
 			return '';
282 282
 		}
283
-		$text = strip_shortcodes( wp_strip_all_tags( $post->post_excerpt ));
284
-		return wp_trim_words( $text, apply_filters( 'excerpt_length', 55 ));
283
+		$text = strip_shortcodes( wp_strip_all_tags( $post->post_excerpt ) );
284
+		return wp_trim_words( $text, apply_filters( 'excerpt_length', 55 ) );
285 285
 	}
286 286
 
287 287
 	/**
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 */
314 314
 	protected function setPostCounts()
315 315
 	{
316
-		$postIds = array_map( 'trim', explode( ',', $this->args['assigned_to'] ));
316
+		$postIds = array_map( 'trim', explode( ',', $this->args['assigned_to'] ) );
317 317
 		foreach( $postIds as $postId ) {
318 318
 			$this->reviewCounts[] = glsr( CountsManager::class )->getPostCounts( $postId );
319 319
 		}
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 	 */
325 325
 	protected function setTermCounts()
326 326
 	{
327
-		$termIds = array_map( 'trim', explode( ',', $this->args['category'] ));
327
+		$termIds = array_map( 'trim', explode( ',', $this->args['category'] ) );
328 328
 		foreach( $termIds as $termId ) {
329 329
 			$term = get_term( $termId, Application::TAXONOMY );
330
-			if( !isset( $term->term_id ))continue;
330
+			if( !isset($term->term_id) )continue;
331 331
 			$this->reviewCounts[] = glsr( CountsManager::class )->getTermCounts( $termId );
332 332
 		}
333 333
 	}
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 		foreach( glsr( ReviewManager::class )->get( $this->args )->results as $review ) {
41 41
 			// Only include critic reviews that have been directly produced by your site, not reviews from third- party sites or syndicated reviews.
42 42
 			// @see https://developers.google.com/search/docs/data-types/review
43
-			if( $review->review_type != 'local' )continue;
43
+			if( $review->review_type != 'local' ) {
44
+				continue;
45
+			}
44 46
 			$reviews[] = $this->buildReview( $review );
45 47
 		}
46 48
 		if( !empty( $reviews )) {
@@ -85,7 +87,9 @@  discard block
 block discarded – undo
85 87
 	 */
86 88
 	public function render()
87 89
 	{
88
-		if( is_null( glsr()->schemas ))return;
90
+		if( is_null( glsr()->schemas )) {
91
+			return;
92
+		}
89 93
 		printf( '<script type="application/ld+json">%s</script>', json_encode(
90 94
 			apply_filters( 'site-reviews/schema/all', glsr()->schemas ),
91 95
 			JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
@@ -137,7 +141,9 @@  discard block
 block discarded – undo
137 141
 	{
138 142
 		foreach( $values as $value ) {
139 143
 			$option = $this->getSchemaOptionValue( $value );
140
-			if( empty( $option ))continue;
144
+			if( empty( $option )) {
145
+				continue;
146
+			}
141 147
 			$schema->$value( $option );
142 148
 		}
143 149
 		return $schema;
@@ -249,7 +255,9 @@  discard block
 block discarded – undo
249 255
 		if( $value != $fallback ) {
250 256
 			return $value;
251 257
 		}
252
-		if( !is_single() && !is_page() )return;
258
+		if( !is_single() && !is_page() ) {
259
+			return;
260
+		}
253 261
 		$method = glsr( Helper::class )->buildMethodName( $option, 'getThing' );
254 262
 		if( method_exists( $this, $method )) {
255 263
 			return $this->$method();
@@ -327,7 +335,9 @@  discard block
 block discarded – undo
327 335
 		$termIds = array_map( 'trim', explode( ',', $this->args['category'] ));
328 336
 		foreach( $termIds as $termId ) {
329 337
 			$term = get_term( $termId, Application::TAXONOMY );
330
-			if( !isset( $term->term_id ))continue;
338
+			if( !isset( $term->term_id )) {
339
+				continue;
340
+			}
331 341
 			$this->reviewCounts[] = glsr( CountsManager::class )->getTermCounts( $termId );
332 342
 		}
333 343
 	}
Please login to merge, or discard this patch.
plugin/Database/SqlQueries.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function deleteAllSessions( $sessionCookiePrefix )
25 25
 	{
26
-		return $this->db->query("
26
+		return $this->db->query( "
27 27
 			DELETE
28 28
 			FROM {$this->db->options}
29 29
 			WHERE option_name LIKE '{$sessionCookiePrefix}_%'
30
-		");
30
+		" );
31 31
 	}
32 32
 
33 33
 	/**
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public function deleteExpiredSessions( $expiredSessions )
38 38
 	{
39
-		return $this->db->query("
39
+		return $this->db->query( "
40 40
 			DELETE
41 41
 			FROM {$this->db->options}
42 42
 			WHERE option_name IN ('{$expiredSessions}')
43
-		");
43
+		" );
44 44
 	}
45 45
 
46 46
 	/**
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function getReviewCountsFor( $metaKey )
51 51
 	{
52
-		return (array) $this->db->get_results("
52
+		return (array)$this->db->get_results( "
53 53
 			SELECT m.meta_value AS name, COUNT(*) num_posts
54 54
 			FROM {$this->db->posts} AS p
55 55
 			INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
56 56
 			WHERE p.post_type = '{$this->postType}'
57 57
 			AND m.meta_key = '{$metaKey}'
58 58
 			GROUP BY name
59
-		");
59
+		" );
60 60
 	}
61 61
 
62 62
 	/**
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function getExpiredSessions( $sessionCookiePrefix, $limit )
68 68
 	{
69
-		return $this->db->get_results("
69
+		return $this->db->get_results( "
70 70
 			SELECT option_name AS name, option_value AS expiration
71 71
 			FROM {$this->db->options}
72 72
 			WHERE option_name LIKE '{$sessionCookiePrefix}_expires_%'
73 73
 			ORDER BY option_value ASC
74 74
 			LIMIT 0, {$limit}
75
-		");
75
+		" );
76 76
 	}
77 77
 
78 78
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function getReviewCounts( $lastPostId = 0, $limit = 500 )
84 84
 	{
85
-		return $this->db->get_results("
85
+		return $this->db->get_results( "
86 86
 			SELECT p.ID, m1.meta_value AS rating, m2.meta_value AS type
87 87
 			FROM {$this->db->posts} AS p
88 88
 			INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function getReviewPostId( $metaReviewId )
105 105
 	{
106
-		$postId = $this->db->get_var("
106
+		$postId = $this->db->get_var( "
107 107
 			SELECT p.ID
108 108
 			FROM {$this->db->posts} AS p
109 109
 			INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
110 110
 			WHERE p.post_type = '{$this->postType}'
111 111
 			AND m.meta_key = 'review_id'
112 112
 			AND m.meta_value = '{$metaReviewId}'
113
-		");
113
+		" );
114 114
 		return intval( $postId );
115 115
 	}
116 116
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function getReviewIdsByType( $reviewType )
122 122
 	{
123
-		$query = $this->db->get_col("
123
+		$query = $this->db->get_col( "
124 124
 			SELECT m1.meta_value AS review_id
125 125
 			FROM {$this->db->posts} AS p
126 126
 			INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 			AND m1.meta_key = 'review_id'
130 130
 			AND m2.meta_key = 'review_type'
131 131
 			AND m2.meta_value = '{$reviewType}'
132
-		");
133
-		return array_keys( array_flip( $query ));
132
+		" );
133
+		return array_keys( array_flip( $query ) );
134 134
 	}
135 135
 
136 136
 	/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function getReviewPostCounts( $postId, $lastPostId = 0, $limit = 500 )
143 143
 	{
144
-		return $this->db->get_results("
144
+		return $this->db->get_results( "
145 145
 			SELECT p.ID, m1.meta_value AS rating, m2.meta_value AS type
146 146
 			FROM {$this->db->posts} AS p
147 147
 			INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 	public function getReviewRatingsFromIds( array $postIds, $greaterThanId = 0, $limit = 100 )
168 168
 	{
169 169
 		sort( $postIds );
170
-		$postIds = array_slice( $postIds, intval( array_search( $greaterThanId, $postIds )), $limit );
170
+		$postIds = array_slice( $postIds, intval( array_search( $greaterThanId, $postIds ) ), $limit );
171 171
 		$postIds = implode( ',', $postIds );
172
-		return $this->db->get_results("
172
+		return $this->db->get_results( "
173 173
 			SELECT p.ID, m.meta_value AS rating
174 174
 			FROM {$this->db->posts} AS p
175 175
 			INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		$queryBuilder = glsr( QueryBuilder::class );
194 194
 		$key = $queryBuilder->buildSqlOr( $key, "m.meta_key = '%s'" );
195 195
 		$status = $queryBuilder->buildSqlOr( $status, "p.post_status = '%s'" );
196
-		return $this->db->get_col("
196
+		return $this->db->get_col( "
197 197
 			SELECT DISTINCT m.meta_value
198 198
 			FROM {$this->db->postmeta} m
199 199
 			LEFT JOIN {$this->db->posts} p ON p.ID = m.post_id
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			AND ({$key})
202 202
 			AND ({$status})
203 203
 			ORDER BY m.meta_value
204
-		");
204
+		" );
205 205
 	}
206 206
 
207 207
 	/**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	public function getReviewTermCounts( $termId, $lastPostId = 0, $limit = 500 )
214 214
 	{
215
-		return $this->db->get_results("
215
+		return $this->db->get_results( "
216 216
 			SELECT p.ID, m1.meta_value AS rating, m2.meta_value AS type
217 217
 			FROM {$this->db->posts} AS p
218 218
 			INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id
Please login to merge, or discard this patch.
plugin/Database/CountsManager.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 			$this->getCounts(),
66 66
 			$review->review_type,
67 67
 			$review->rating
68
-		));
68
+		) );
69 69
 	}
70 70
 
71 71
 	/**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function decreasePostCounts( Review $review )
75 75
 	{
76
-		if( empty( $counts = $this->getPostCounts( $review->assigned_to )))return;
76
+		if( empty($counts = $this->getPostCounts( $review->assigned_to )) )return;
77 77
 		$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
78 78
 		$this->setPostCounts( $review->assigned_to, $counts );
79 79
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	public function decreaseTermCounts( Review $review )
85 85
 	{
86 86
 		foreach( $review->term_ids as $termId ) {
87
-			if( empty( $counts = $this->getTermCounts( $termId )))continue;
87
+			if( empty($counts = $this->getTermCounts( $termId )) )continue;
88 88
 			$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
89 89
 			$this->setTermCounts( $termId, $counts );
90 90
 		}
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
 	public function flatten( array $reviewCounts, array $args = [] )
97 97
 	{
98 98
 		$counts = [];
99
-		array_walk_recursive( $reviewCounts, function( $num, $index ) use( &$counts ) {
100
-			$counts[$index] = isset( $counts[$index] )
99
+		array_walk_recursive( $reviewCounts, function( $num, $index ) use(&$counts) {
100
+			$counts[$index] = isset($counts[$index])
101 101
 				? $num + $counts[$index]
102 102
 				: $num;
103 103
 		});
104 104
 		$args = wp_parse_args( $args, ['max' => Rating::MAX_RATING, 'min' => Rating::MIN_RATING] );
105
-		array_walk( $counts, function( &$ratings ) use( $args ) {
105
+		array_walk( $counts, function( &$ratings ) use($args) {
106 106
 			foreach( $ratings as $index => &$num ) {
107
-				if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue;
107
+				if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ) )continue;
108 108
 				$num = 0;
109 109
 			}
110 110
 		});
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	public function increaseCounts( Review $review )
154 154
 	{
155
-		if( empty( $counts = $this->getCounts() )) {
155
+		if( empty($counts = $this->getCounts()) ) {
156 156
 			$counts = $this->buildCounts();
157 157
 		}
158 158
 		$this->setCounts( $this->increaseRating(
159 159
 			$counts,
160 160
 			$review->review_type,
161 161
 			$review->rating
162
-		));
162
+		) );
163 163
 	}
164 164
 
165 165
 	/**
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public function increasePostCounts( Review $review )
169 169
 	{
170
-		if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return;
171
-		if( empty( $counts = $this->getPostCounts( $review->assigned_to ))) {
170
+		if( !(get_post( $review->assigned_to ) instanceof WP_Post) )return;
171
+		if( empty($counts = $this->getPostCounts( $review->assigned_to )) ) {
172 172
 			$counts = $this->buildPostCounts( $review->assigned_to );
173 173
 		}
174 174
 		$counts = $this->increaseRating( $counts, $review->review_type, $review->rating );
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	public function increaseTermCounts( Review $review )
182 182
 	{
183 183
 		foreach( $review->term_ids as $termId ) {
184
-			if( !( get_term( $termId, Application::TAXONOMY ) instanceof WP_Term ))continue;
185
-			if( empty( $counts = $this->getTermCounts( $termId ))) {
184
+			if( !(get_term( $termId, Application::TAXONOMY ) instanceof WP_Term) )continue;
185
+			if( empty($counts = $this->getTermCounts( $termId )) ) {
186 186
 				$counts = $this->buildTermCounts( $termId );
187 187
 			}
188 188
 			$counts = $this->increaseRating( $counts, $review->review_type, $review->rating );
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 	{
207 207
 		$ratingCounts = glsr( CountsManager::class )->flatten( $reviewCounts );
208 208
 		update_post_meta( $postId, static::META_COUNT, $reviewCounts );
209
-		update_post_meta( $postId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
210
-		update_post_meta( $postId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ));
209
+		update_post_meta( $postId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ) );
210
+		update_post_meta( $postId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ) );
211 211
 	}
212 212
 
213 213
 	/**
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function setTermCounts( $termId, array $reviewCounts )
218 218
 	{
219
-		if( !term_exists( $termId ))return;
219
+		if( !term_exists( $termId ) )return;
220 220
 		$ratingCounts = glsr( CountsManager::class )->flatten( $reviewCounts );
221 221
 		update_term_meta( $termId, static::META_COUNT, $reviewCounts );
222
-		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
223
-		update_term_meta( $termId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ));
222
+		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ) );
223
+		update_term_meta( $termId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ) );
224 224
 	}
225 225
 
226 226
 	/**
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
 	{
232 232
 		$counts = [];
233 233
 		$lastPostId = 0;
234
-		while( $reviews = $this->queryReviews( $args, $lastPostId, $limit )) {
235
-			$types = array_keys( array_flip( array_column( $reviews, 'type' )));
234
+		while( $reviews = $this->queryReviews( $args, $lastPostId, $limit ) ) {
235
+			$types = array_keys( array_flip( array_column( $reviews, 'type' ) ) );
236 236
 			foreach( $types as $type ) {
237
-				if( isset( $counts[$type] ))continue;
237
+				if( isset($counts[$type]) )continue;
238 238
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
239 239
 			}
240 240
 			foreach( $reviews as $review ) {
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	protected function decreaseRating( array $reviewCounts, $type, $rating )
254 254
 	{
255
-		if( isset( $reviewCounts[$type][$rating] )) {
255
+		if( isset($reviewCounts[$type][$rating]) ) {
256 256
 			$reviewCounts[$type][$rating] = max( 0, $reviewCounts[$type][$rating] - 1 );
257 257
 		}
258 258
 		return $reviewCounts;
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	protected function increaseRating( array $reviewCounts, $type, $rating )
267 267
 	{
268
-		if( !array_key_exists( $type, glsr()->reviewTypes )) {
268
+		if( !array_key_exists( $type, glsr()->reviewTypes ) ) {
269 269
 			return $reviewCounts;
270 270
 		}
271
-		if( !array_key_exists( $type, $reviewCounts )) {
271
+		if( !array_key_exists( $type, $reviewCounts ) ) {
272 272
 			$reviewCounts[$type] = [];
273 273
 		}
274 274
 		$reviewCounts = $this->normalize( $reviewCounts );
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	{
284 284
 		foreach( $reviewCounts as &$counts ) {
285 285
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
286
-				if( isset( $counts[$index] ))continue;
286
+				if( isset($counts[$index]) )continue;
287 287
 				$counts[$index] = 0;
288 288
 			}
289 289
 			ksort( $counts );
@@ -298,14 +298,14 @@  discard block
 block discarded – undo
298 298
 	 */
299 299
 	protected function queryReviews( array $args = [], $lastPostId, $limit )
300 300
 	{
301
-		$args = wp_parse_args( $args, array_fill_keys( ['post_id', 'term_id'], '' ));
302
-		if( empty( array_filter( $args ))) {
301
+		$args = wp_parse_args( $args, array_fill_keys( ['post_id', 'term_id'], '' ) );
302
+		if( empty(array_filter( $args )) ) {
303 303
 			return glsr( SqlQueries::class )->getReviewCounts( $lastPostId, $limit );
304 304
 		}
305
-		if( !empty( $args['post_id'] )) {
305
+		if( !empty($args['post_id']) ) {
306 306
 			return glsr( SqlQueries::class )->getReviewPostCounts( $args['post_id'], $lastPostId, $limit );
307 307
 		}
308
-		if( !empty( $args['term_id'] )) {
308
+		if( !empty($args['term_id']) ) {
309 309
 			return glsr( SqlQueries::class )->getReviewTermCounts( $args['term_id'], $lastPostId, $limit );
310 310
 		}
311 311
 	}
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -73,7 +73,9 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function decreasePostCounts( Review $review )
75 75
 	{
76
-		if( empty( $counts = $this->getPostCounts( $review->assigned_to )))return;
76
+		if( empty( $counts = $this->getPostCounts( $review->assigned_to ))) {
77
+			return;
78
+		}
77 79
 		$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
78 80
 		$this->setPostCounts( $review->assigned_to, $counts );
79 81
 	}
@@ -84,7 +86,9 @@  discard block
 block discarded – undo
84 86
 	public function decreaseTermCounts( Review $review )
85 87
 	{
86 88
 		foreach( $review->term_ids as $termId ) {
87
-			if( empty( $counts = $this->getTermCounts( $termId )))continue;
89
+			if( empty( $counts = $this->getTermCounts( $termId ))) {
90
+				continue;
91
+			}
88 92
 			$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
89 93
 			$this->setTermCounts( $termId, $counts );
90 94
 		}
@@ -104,7 +108,9 @@  discard block
 block discarded – undo
104 108
 		$args = wp_parse_args( $args, ['max' => Rating::MAX_RATING, 'min' => Rating::MIN_RATING] );
105 109
 		array_walk( $counts, function( &$ratings ) use( $args ) {
106 110
 			foreach( $ratings as $index => &$num ) {
107
-				if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue;
111
+				if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] )) {
112
+					continue;
113
+				}
108 114
 				$num = 0;
109 115
 			}
110 116
 		});
@@ -167,7 +173,9 @@  discard block
 block discarded – undo
167 173
 	 */
168 174
 	public function increasePostCounts( Review $review )
169 175
 	{
170
-		if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return;
176
+		if( !( get_post( $review->assigned_to ) instanceof WP_Post )) {
177
+			return;
178
+		}
171 179
 		if( empty( $counts = $this->getPostCounts( $review->assigned_to ))) {
172 180
 			$counts = $this->buildPostCounts( $review->assigned_to );
173 181
 		}
@@ -181,7 +189,9 @@  discard block
 block discarded – undo
181 189
 	public function increaseTermCounts( Review $review )
182 190
 	{
183 191
 		foreach( $review->term_ids as $termId ) {
184
-			if( !( get_term( $termId, Application::TAXONOMY ) instanceof WP_Term ))continue;
192
+			if( !( get_term( $termId, Application::TAXONOMY ) instanceof WP_Term )) {
193
+				continue;
194
+			}
185 195
 			if( empty( $counts = $this->getTermCounts( $termId ))) {
186 196
 				$counts = $this->buildTermCounts( $termId );
187 197
 			}
@@ -216,7 +226,9 @@  discard block
 block discarded – undo
216 226
 	 */
217 227
 	public function setTermCounts( $termId, array $reviewCounts )
218 228
 	{
219
-		if( !term_exists( $termId ))return;
229
+		if( !term_exists( $termId )) {
230
+			return;
231
+		}
220 232
 		$ratingCounts = glsr( CountsManager::class )->flatten( $reviewCounts );
221 233
 		update_term_meta( $termId, static::META_COUNT, $reviewCounts );
222 234
 		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
@@ -234,7 +246,9 @@  discard block
 block discarded – undo
234 246
 		while( $reviews = $this->queryReviews( $args, $lastPostId, $limit )) {
235 247
 			$types = array_keys( array_flip( array_column( $reviews, 'type' )));
236 248
 			foreach( $types as $type ) {
237
-				if( isset( $counts[$type] ))continue;
249
+				if( isset( $counts[$type] )) {
250
+					continue;
251
+				}
238 252
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
239 253
 			}
240 254
 			foreach( $reviews as $review ) {
@@ -283,7 +297,9 @@  discard block
 block discarded – undo
283 297
 	{
284 298
 		foreach( $reviewCounts as &$counts ) {
285 299
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
286
-				if( isset( $counts[$index] ))continue;
300
+				if( isset( $counts[$index] )) {
301
+					continue;
302
+				}
287 303
 				$counts[$index] = 0;
288 304
 			}
289 305
 			ksort( $counts );
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Metaboxes.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	public function saveAssignedToMetabox( $postId )
15 15
 	{
16
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return;
17
-		$assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ));
16
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ) )return;
17
+		$assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ) );
18 18
 		if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) {
19
-			$review = glsr( ReviewManager::class )->single( get_post( $postId ));
19
+			$review = glsr( ReviewManager::class )->single( get_post( $postId ) );
20 20
 			glsr( CountsManager::class )->decreasePostCounts( $review );
21 21
 		}
22 22
 		update_post_meta( $postId, 'assigned_to', $assignedTo );
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function saveResponseMetabox( $postId )
30 30
 	{
31
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return;
32
-		$response = strval( glsr( Helper::class )->filterInput( 'response' ));
31
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ) )return;
32
+		$response = strval( glsr( Helper::class )->filterInput( 'response' ) );
33 33
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
34 34
 			'a' => ['href' => [], 'title' => []],
35 35
 			'em' => [],
36 36
 			'strong' => [],
37
-		])));
37
+		] ) ) );
38 38
 	}
39 39
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	public function saveAssignedToMetabox( $postId )
15 15
 	{
16
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return;
16
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' )) {
17
+			return;
18
+		}
17 19
 		$assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ));
18 20
 		if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) {
19 21
 			$review = glsr( ReviewManager::class )->single( get_post( $postId ));
@@ -28,7 +30,9 @@  discard block
 block discarded – undo
28 30
 	 */
29 31
 	public function saveResponseMetabox( $postId )
30 32
 	{
31
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return;
33
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' )) {
34
+			return;
35
+		}
32 36
 		$response = strval( glsr( Helper::class )->filterInput( 'response' ));
33 37
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
34 38
 			'a' => ['href' => [], 'title' => []],
Please login to merge, or discard this patch.
plugin/Controllers/ReviewController.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function onAfterChangeCategory( $postId, $terms, $termIds, $taxonomySlug, $append, $oldTermIds )
25 25
 	{
26
-		if( !$this->isReviewPostId( $postId ))return;
27
-		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
26
+		if( !$this->isReviewPostId( $postId ) )return;
27
+		$review = glsr( ReviewManager::class )->single( get_post( $postId ) );
28 28
 		$ignoredTerms = array_intersect( $oldTermIds, $termIds );
29 29
 		$review->term_ids = array_diff( $oldTermIds, $ignoredTerms );
30 30
 		glsr( CountsManager::class )->decreaseTermCounts( $review );
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function onAfterCreate( $postData, $meta, $postId )
43 43
 	{
44
-		if( !$this->isReviewPostId( $postId ))return;
45
-		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
44
+		if( !$this->isReviewPostId( $postId ) )return;
45
+		$review = glsr( ReviewManager::class )->single( get_post( $postId ) );
46 46
 		glsr( CountsManager::class )->increase( $review );
47 47
 	}
48 48
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function onBeforeDelete( $postId )
55 55
 	{
56
-		if( !$this->isReviewPostId( $postId ))return;
57
-		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
56
+		if( !$this->isReviewPostId( $postId ) )return;
57
+		$review = glsr( ReviewManager::class )->single( get_post( $postId ) );
58 58
 		glsr( CountsManager::class )->decrease( $review );
59 59
 	}
60 60
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		if( !$this->isReviewPostId( $postId )
72 72
 			|| !in_array( $metaKey, ['assigned_to', 'rating', 'review_type'] )
73 73
 		)return;
74
-		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
74
+		$review = glsr( ReviewManager::class )->single( get_post( $postId ) );
75 75
 		if( $review->$metaKey == $metaValue )return;
76 76
 		$method = glsr( Helper::class )->buildMethodName( $metaKey, 'onBeforeChange' );
77 77
 		call_user_func( [$this, $method], $review, $metaValue );
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	public function onChangeStatus( $newStatus, $oldStatus, WP_Post $post )
120 120
 	{
121
-		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ))return;
122
-		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
121
+		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ) )return;
122
+		$review = glsr( ReviewManager::class )->single( get_post( $postId ) );
123 123
 		if( $status == 'publish' ) {
124 124
 			glsr( CountsManager::class )->increase( $review );
125 125
 		}
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function onAfterChangeCategory( $postId, $terms, $termIds, $taxonomySlug, $append, $oldTermIds )
25 25
 	{
26
-		if( !$this->isReviewPostId( $postId ))return;
26
+		if( !$this->isReviewPostId( $postId )) {
27
+			return;
28
+		}
27 29
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
28 30
 		$ignoredTerms = array_intersect( $oldTermIds, $termIds );
29 31
 		$review->term_ids = array_diff( $oldTermIds, $ignoredTerms );
@@ -41,7 +43,9 @@  discard block
 block discarded – undo
41 43
 	 */
42 44
 	public function onAfterCreate( $postData, $meta, $postId )
43 45
 	{
44
-		if( !$this->isReviewPostId( $postId ))return;
46
+		if( !$this->isReviewPostId( $postId )) {
47
+			return;
48
+		}
45 49
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
46 50
 		glsr( CountsManager::class )->increase( $review );
47 51
 	}
@@ -53,7 +57,9 @@  discard block
 block discarded – undo
53 57
 	 */
54 58
 	public function onBeforeDelete( $postId )
55 59
 	{
56
-		if( !$this->isReviewPostId( $postId ))return;
60
+		if( !$this->isReviewPostId( $postId )) {
61
+			return;
62
+		}
57 63
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
58 64
 		glsr( CountsManager::class )->decrease( $review );
59 65
 	}
@@ -70,9 +76,13 @@  discard block
 block discarded – undo
70 76
 	{
71 77
 		if( !$this->isReviewPostId( $postId )
72 78
 			|| !in_array( $metaKey, ['assigned_to', 'rating', 'review_type'] )
73
-		)return;
79
+		) {
80
+			return;
81
+		}
74 82
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
75
-		if( $review->$metaKey == $metaValue )return;
83
+		if( $review->$metaKey == $metaValue ) {
84
+			return;
85
+		}
76 86
 		$method = glsr( Helper::class )->buildMethodName( $metaKey, 'onBeforeChange' );
77 87
 		call_user_func( [$this, $method], $review, $metaValue );
78 88
 	}
@@ -118,7 +128,9 @@  discard block
 block discarded – undo
118 128
 	 */
119 129
 	public function onChangeStatus( $newStatus, $oldStatus, WP_Post $post )
120 130
 	{
121
-		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ))return;
131
+		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] )) {
132
+			return;
133
+		}
122 134
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
123 135
 		if( $status == 'publish' ) {
124 136
 			glsr( CountsManager::class )->increase( $review );
Please login to merge, or discard this patch.