Test Failed
Push — master ( 59b255...755753 )
by Paul
04:04
created
plugin/Modules/Schema/BaseType.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function __call( $method, array $arguments )
41 41
 	{
42
-		$value = isset( $arguments[0] )
42
+		$value = isset($arguments[0])
43 43
 			? $arguments[0]
44 44
 			: '';
45 45
 		return $this->setProperty( $method, $value );
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 	 * @param mixed $default
97 97
 	 * @return mixed
98 98
 	 */
99
-	public function getProperty( $property, $default = null)
99
+	public function getProperty( $property, $default = null )
100 100
 	{
101
-		return isset( $this->properties[$property] )
101
+		return isset($this->properties[$property])
102 102
 			? $this->properties[$property]
103 103
 			: $default;
104 104
 	}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	public function offsetUnset( $offset )
168 168
 	{
169
-		unset( $this->properties[$offset] );
169
+		unset($this->properties[$offset]);
170 170
 	}
171 171
 
172 172
 	/**
@@ -212,16 +212,16 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	protected function getParents( $parents = null )
214 214
 	{
215
-		if( !isset( $parents )) {
215
+		if( !isset($parents) ) {
216 216
 			$parents = $this->parents;
217 217
 		}
218 218
 		$newParents = $parents;
219 219
 		foreach( $parents as $parent ) {
220 220
 			$parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ );
221
-			if( !class_exists( $parentClass ))continue;
222
-			$newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents ));
221
+			if( !class_exists( $parentClass ) )continue;
222
+			$newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents ) );
223 223
 		}
224
-		return array_values( array_unique( $newParents ));
224
+		return array_values( array_unique( $newParents ) );
225 225
 	}
226 226
 
227 227
 	/**
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
 		$parents = $this->getParents();
233 233
 		foreach( $parents as $parent ) {
234 234
 			$parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ );
235
-			if( !class_exists( $parentClass ))continue;
236
-			$this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed )));
235
+			if( !class_exists( $parentClass ) )continue;
236
+			$this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ) ) );
237 237
 		}
238 238
 	}
239 239
 
@@ -243,17 +243,17 @@  discard block
 block discarded – undo
243 243
 	 */
244 244
 	protected function serializeProperty( $property )
245 245
 	{
246
-		if( is_array( $property )) {
246
+		if( is_array( $property ) ) {
247 247
 			return array_map( [$this, 'serializeProperty'], $property );
248 248
 		}
249 249
 		if( $property instanceof Type ) {
250 250
 			$property = $property->toArray();
251
-			unset( $property['@context'] );
251
+			unset($property['@context']);
252 252
 		}
253 253
 		if( $property instanceof DateTimeInterface ) {
254 254
 			$property = $property->format( DateTime::ATOM );
255 255
 		}
256
-		if( is_object( $property )) {
256
+		if( is_object( $property ) ) {
257 257
 			throw new InvalidProperty();
258 258
 		}
259 259
 		return $property;
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviews.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 				'navigation' => $navigation,
58 58
 			],
59 59
 			'reviews' => $this->buildReviews(),
60
-		]);
60
+		] );
61 61
 	}
62 62
 
63 63
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$reviewValues = [];
84 84
 		foreach( $review as $key => $value ) {
85 85
 			$method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' );
86
-			if( !method_exists( $this, $method ))continue;
86
+			if( !method_exists( $this, $method ) )continue;
87 87
 			$reviewValues[$key] = $this->$method( $key, $value );
88 88
 		}
89 89
 		$reviewValues = apply_filters( 'site-reviews/review/build/after', $reviewValues );
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	protected function buildOptionAssignedTo( $key, $value )
99 99
 	{
100
-		if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ))return;
101
-		$post = get_post( intval( $value ));
102
-		if( !( $post instanceof WP_Post ))return;
100
+		if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ) )return;
101
+		$post = get_post( intval( $value ) );
102
+		if( !($post instanceof WP_Post) )return;
103 103
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
104 104
 			'href' => get_the_permalink( $post->ID ),
105
-		]);
105
+		] );
106 106
 		$assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink );
107 107
 		return $this->wrap( $key, '<span>'.$assignedTo.'</span>' );
108 108
 	}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	protected function buildOptionAuthor( $key, $value )
116 116
 	{
117
-		if( $this->isHidden( $key ))return;
117
+		if( $this->isHidden( $key ) )return;
118 118
 		$prefix = !$this->isOptionEnabled( 'settings.reviews.avatars.enabled' )
119 119
 			? apply_filters( 'site-reviews/review/author/prefix', '&mdash;' )
120 120
 			: '';
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	protected function buildOptionAvatar( $key, $value )
130 130
 	{
131
-		if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ))return;
131
+		if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ) )return;
132 132
 		$size = $this->getOption( 'settings.reviews.avatars.size', 40 );
133
-		return $this->wrap( $key, glsr( Builder::class )->img([
133
+		return $this->wrap( $key, glsr( Builder::class )->img( [
134 134
 			'src' => $this->generateAvatar( $value ),
135 135
 			'height' => $size,
136 136
 			'width' => $size,
137
-		]));
137
+		] ) );
138 138
 	}
139 139
 
140 140
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	protected function buildOptionContent( $key, $value )
146 146
 	{
147 147
 		$text = $this->normalizeText( $value );
148
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
148
+		if( $this->isHiddenOrEmpty( $key, $text ) )return;
149 149
 		return $this->wrap( $key, '<p>'.$text.'</p>' );
150 150
 	}
151 151
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	protected function buildOptionDate( $key, $value )
158 158
 	{
159
-		if( $this->isHidden( $key ))return;
159
+		if( $this->isHidden( $key ) )return;
160 160
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
161 161
 		if( $dateFormat == 'relative' ) {
162 162
 			$date = glsr( Date::class )->relative( $value );
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			$format = $dateFormat == 'custom'
166 166
 				? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' )
167 167
 				: (string)get_option( 'date_format' );
168
-			$date = date_i18n( $format, strtotime( $value ));
168
+			$date = date_i18n( $format, strtotime( $value ) );
169 169
 		}
170 170
 		return $this->wrap( $key, '<span>'.$date.'</span>' );
171 171
 	}
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	protected function buildOptionRating( $key, $value )
179 179
 	{
180
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
180
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
181 181
 		$rating = glsr( Html::class )->buildPartial( 'star-rating', [
182 182
 			'rating' => $value,
183
-		]);
183
+		] );
184 184
 		return $this->wrap( $key, $rating );
185 185
 	}
186 186
 
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	protected function buildOptionResponse( $key, $value )
193 193
 	{
194
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
195
-		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
194
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
195
+		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) );
196 196
 		$text = $this->normalizeText( $value );
197 197
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
198 198
 		return $this->wrap( $key,
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	protected function buildOptionTitle( $key, $value )
210 210
 	{
211
-		if( $this->isHidden( $key ))return;
212
-		if( empty( $value )) {
211
+		if( $this->isHidden( $key ) )return;
212
+		if( empty($value) ) {
213 213
 			$value = __( 'No Title', 'site-reviews' );
214 214
 		}
215 215
 		return $this->wrap( $key, '<h3>'.$value.'</h3>' );
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			return $avatarUrl;
228 228
 		}
229 229
 		$authorIdOrEmail = get_the_author_meta( 'ID', $review->user_id );
230
-		if( empty( $authorIdOrEmail )) {
230
+		if( empty($authorIdOrEmail) ) {
231 231
 			$authorIdOrEmail = $review->email;
232 232
 		}
233 233
 		return (string)get_avatar_url( $authorIdOrEmail );
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	protected function generateSchema()
240 240
 	{
241
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
241
+		if( !wp_validate_boolean( $this->args['schema'] ) )return;
242 242
 		glsr( Schema::class )->store(
243 243
 			glsr( Schema::class )->build( $this->args )
244 244
 		);
@@ -262,18 +262,18 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	protected function getExcerpt( $text )
264 264
 	{
265
-		$limit = intval( $this->getOption( 'settings.reviews.excerpt.length', 55 ));
265
+		$limit = intval( $this->getOption( 'settings.reviews.excerpt.length', 55 ) );
266 266
 		$split = extension_loaded( 'intl' )
267 267
 			? $this->getExcerptIntlSplit( $text, $limit )
268 268
 			: $this->getExcerptSplit( $text, $limit );
269 269
 		$hiddenText = substr( $text, $split );
270
-		if( !empty( $hiddenText )) {
270
+		if( !empty($hiddenText) ) {
271 271
 			$showMore = glsr( Builder::class )->span( $hiddenText, [
272 272
 				'class' => 'glsr-hidden glsr-hidden-text',
273 273
 				'data-show-less' => __( 'Show less', 'site-reviews' ),
274 274
 				'data-show-more' => __( 'Show more', 'site-reviews' ),
275
-			]);
276
-			$text = ltrim( substr( $text, 0, $split )).$showMore;
275
+			] );
276
+			$text = ltrim( substr( $text, 0, $split ) ).$showMore;
277 277
 		}
278 278
 		return nl2br( $text );
279 279
 	}
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		$words = IntlRuleBasedBreakIterator::createWordInstance( '' );
289 289
 		$words->setText( $text );
290 290
 		$count = 0;
291
-		foreach( $words as $offset ){
291
+		foreach( $words as $offset ) {
292 292
 			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
293 293
 			$count++;
294 294
 			if( $count != $limit )continue;
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	protected function getExcerptSplit( $text, $limit )
306 306
 	{
307 307
 		if( str_word_count( $text, 0 ) > $limit ) {
308
-			$words = array_keys( str_word_count( $text, 2 ));
308
+			$words = array_keys( str_word_count( $text, 2 ) );
309 309
 			return $words[$limit];
310 310
 		}
311 311
 		return strlen( $text );
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	protected function getOption( $path, $fallback = '' )
320 320
 	{
321
-		if( array_key_exists( $path, $this->options )) {
321
+		if( array_key_exists( $path, $this->options ) ) {
322 322
 			return $this->options[$path];
323 323
 		}
324 324
 		return $fallback;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 */
332 332
 	protected function isHidden( $key, $path = '' )
333 333
 	{
334
-		$isOptionEnabled = !empty( $path )
334
+		$isOptionEnabled = !empty($path)
335 335
 			? $this->isOptionEnabled( $path )
336 336
 			: true;
337 337
 		return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled;
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 */
345 345
 	protected function isHiddenOrEmpty( $key, $value )
346 346
 	{
347
-		return $this->isHidden( $key ) || empty( $value );
347
+		return $this->isHidden( $key ) || empty($value);
348 348
 	}
349 349
 
350 350
 	/**
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	protected function normalizeText( $text )
364 364
 	{
365 365
 		$text = wp_kses( $text, wp_kses_allowed_html() );
366
-		$text = convert_smilies( wptexturize( strip_shortcodes( $text )));
366
+		$text = convert_smilies( wptexturize( strip_shortcodes( $text ) ) );
367 367
 		$text = str_replace( ']]>', ']]&gt;', $text );
368 368
 		$text = preg_replace( '/(\R){2,}/', '$1', $text );
369 369
 		return $this->isOptionEnabled( 'settings.reviews.excerpt.enabled' )
@@ -380,6 +380,6 @@  discard block
 block discarded – undo
380 380
 	{
381 381
 		return glsr( Builder::class )->div( $value, [
382 382
 			'class' => 'glsr-review-'.$key,
383
-		]);
383
+		] );
384 384
 	}
385 385
 }
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Metaboxes.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function saveAssignedToMetabox( $postId )
87 87
 	{
88
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return;
88
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ) )return;
89 89
 		$assignedTo = glsr( Helper::class )->filterInput( 'assigned_to' );
90 90
 		$assignedTo || $assignedTo = '';
91 91
 		if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) {
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function saveResponseMetabox( $postId )
102 102
 	{
103
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return;
103
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ) )return;
104 104
 		$response = glsr( Helper::class )->filterInput( 'response' );
105 105
 		$response || $response = '';
106 106
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
107 107
 			'a' => ['href' => [], 'title' => []],
108 108
 			'em' => [],
109 109
 			'strong' => [],
110
-		])));
110
+		] ) ) );
111 111
 	}
112 112
 
113 113
 	/**
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	protected function getAssignedToPostId( $postId )
118 118
 	{
119
-		$assignedTo = intval( get_post_meta( $postId, 'assigned_to', true ));
120
-		if(( $post = get_post( $assignedTo )) instanceof WP_Post ) {
119
+		$assignedTo = intval( get_post_meta( $postId, 'assigned_to', true ) );
120
+		if( ($post = get_post( $assignedTo )) instanceof WP_Post ) {
121 121
 			return $post->ID;
122 122
 		}
123 123
 		return false;
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 		$meta = wp_parse_args( $meta, [
132 132
 			'rating' => get_post_meta( $review->ID, 'rating', true ),
133 133
 			'review_type' => get_post_meta( $review->ID, 'review_type', true ),
134
-		]);
134
+		] );
135 135
 		if( !in_array( $meta['review_type'], glsr()->reviewTypes )
136 136
 			|| intval( $meta['rating'] ) > Rating::MAX_RATING
137 137
 		)return;
138 138
 		$counts = glsr( OptionManager::class )->get( 'counts.'.$meta['review_type'], [] );
139 139
 		foreach( range( 0, Rating::MAX_RATING ) as $rating ) {
140
-			if( isset( $counts[$rating] ))continue;
140
+			if( isset($counts[$rating]) )continue;
141 141
 			$counts[$rating] = 0;
142 142
 		}
143 143
 		ksort( $counts );
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	protected function setReviewCounts( WP_Post $review, array $counts )
151 151
 	{
152 152
 		$type = get_post_meta( $review->ID, 'review_type', true );
153
-		if( !in_array( $type, glsr()->reviewTypes ))return;
153
+		if( !in_array( $type, glsr()->reviewTypes ) )return;
154 154
 		glsr( OptionManager::class )->set( 'counts.'.$type, $counts );
155 155
 	}
156 156
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	protected function increaseReviewCount( WP_Post $review, array $meta = [] )
161 161
 	{
162
-		if( $counts = $this->getReviewCounts( $review, $meta )) {
162
+		if( $counts = $this->getReviewCounts( $review, $meta ) ) {
163 163
 			$counts[$rating] -= 1;
164 164
 			$this->setReviewCounts( $review, $counts );
165 165
 		}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	protected function decreaseReviewCount( WP_Post $review, array $meta = [] )
172 172
 	{
173
-		if( $counts = $this->getReviewCounts( $review, $meta )) {
173
+		if( $counts = $this->getReviewCounts( $review, $meta ) ) {
174 174
 			$counts[$rating] += 1;
175 175
 			$this->setReviewCounts( $review, $counts );
176 176
 		}
@@ -197,22 +197,22 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	protected function updateAssignedToPost( WP_Post $review )
199 199
 	{
200
-		if( !( $postId = $this->getAssignedToPostId( $review->ID )))return;
201
-		$reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
202
-		if( empty( $reviewIds ))return;
200
+		if( !($postId = $this->getAssignedToPostId( $review->ID )) )return;
201
+		$reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ) );
202
+		if( empty($reviewIds) )return;
203 203
 		$this->updateReviewIdOfPost( $postId, $review, $reviewIds );
204
-		$updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
205
-		if( empty( $updatedReviewIds )) {
204
+		$updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ) );
205
+		if( empty($updatedReviewIds) ) {
206 206
 			delete_post_meta( $postId, static::META_RANKING );
207 207
 			delete_post_meta( $postId, static::META_REVIEW_ID );
208 208
 		}
209
-		else if( !glsr( Helper::class )->compareArrays( $reviewIds, $updatedReviewIds )) {
210
-			$reviews = glsr( Database::class )->getReviews([
209
+		else if( !glsr( Helper::class )->compareArrays( $reviewIds, $updatedReviewIds ) ) {
210
+			$reviews = glsr( Database::class )->getReviews( [
211 211
 				'count' => -1,
212 212
 				'post__in' => $updatedReviewIds,
213
-			]);
214
-			update_post_meta( $postId, static::META_AVERAGE, $this->recalculatePostAverage( $reviews->results ));
215
-			update_post_meta( $postId, static::META_RANKING, $this->recalculatePostRanking( $reviews->results ));
213
+			] );
214
+			update_post_meta( $postId, static::META_AVERAGE, $this->recalculatePostAverage( $reviews->results ) );
215
+			update_post_meta( $postId, static::META_RANKING, $this->recalculatePostRanking( $reviews->results ) );
216 216
 		}
217 217
 	}
218 218
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		if( $review->post_status != 'publish' ) {
226 226
 			delete_post_meta( $postId, static::META_REVIEW_ID, $review->ID );
227 227
 		}
228
-		else if( !in_array( $review->ID, $reviewIds )) {
228
+		else if( !in_array( $review->ID, $reviewIds ) ) {
229 229
 			add_post_meta( $postId, static::META_REVIEW_ID, $review->ID );
230 230
 		}
231 231
 	}
Please login to merge, or discard this patch.
plugin/Database.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 			'post_type' => Application::POST_TYPE,
36 36
 		];
37 37
 		$postId = wp_insert_post( $post, true );
38
-		if( is_wp_error( $postId )) {
38
+		if( is_wp_error( $postId ) ) {
39 39
 			glsr_log()->error( $postId->get_error_message() );
40 40
 			return false;
41 41
 		}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function deleteReview( $metaReviewId )
53 53
 	{
54
-		if( $postId = $this->getReviewPostId( $metaReviewId )) {
54
+		if( $postId = $this->getReviewPostId( $metaReviewId ) ) {
55 55
 			wp_delete_post( $postId, true );
56 56
 		}
57 57
 	}
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	public function getAssignedToPost( $post, $assignedTo = '' )
65 65
 	{
66 66
 		$post = get_post( $post );
67
-		if( !( $post instanceof WP_Post ))return;
68
-		if( empty( $assignedTo )) {
67
+		if( !($post instanceof WP_Post) )return;
68
+		if( empty($assignedTo) ) {
69 69
 			$assignedTo = get_post_meta( $post->ID, 'assigned_to', true );
70 70
 		}
71 71
 		$assignedPost = get_post( $assignedTo );
72
-		if( !empty( $assignedTo )
72
+		if( !empty($assignedTo)
73 73
 			&& $assignedPost instanceof WP_Post
74 74
 			&& $assignedPost->ID != $post->ID ) {
75 75
 			return $assignedPost;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function getReview( $post )
84 84
 	{
85
-		if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE )return;
85
+		if( !($post instanceof WP_Post) || $post->post_type != Application::POST_TYPE )return;
86 86
 		$review = $this->getReviewMeta( $post->ID );
87 87
 		$modified = $this->isReviewModified( $post, $review );
88 88
 		$review->content = $post->post_content;
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 	{
105 105
 		$metaKey = $this->normalizeMetaKey( $metaKey );
106 106
 		if( !$metaKey ) {
107
-			return (array) wp_count_posts( Application::POST_TYPE );
107
+			return (array)wp_count_posts( Application::POST_TYPE );
108 108
 		}
109 109
 		$counts = glsr( Cache::class )->getReviewCountsFor( $metaKey );
110 110
 		if( !$metaValue ) {
111 111
 			return $counts;
112 112
 		}
113
-		return isset( $counts[$metaValue] )
113
+		return isset($counts[$metaValue])
114 114
 			? $counts[$metaValue]
115 115
 			: 0;
116 116
 	}
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 	public function getReviewMeta( $postId )
132 132
 	{
133 133
 		$meta = get_post_type( $postId ) == Application::POST_TYPE
134
-			? array_map( 'array_shift', (array) get_post_meta( $postId ))
134
+			? array_map( 'array_shift', (array)get_post_meta( $postId ) )
135 135
 			: [];
136
-		return (object) $this->normalizeMeta( array_filter( $meta, 'strlen' ));
136
+		return (object)$this->normalizeMeta( array_filter( $meta, 'strlen' ) );
137 137
 	}
138 138
 
139 139
 	/**
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		$paged = glsr( QueryBuilder::class )->getPaged(
163 163
 			wp_validate_boolean( $args['pagination'] )
164 164
 		);
165
-		$reviews = new WP_Query([
165
+		$reviews = new WP_Query( [
166 166
 			'meta_key' => 'pinned',
167 167
 			'meta_query' => $metaQuery,
168 168
 			'offset' => $args['offset'],
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 			'post_type' => Application::POST_TYPE,
176 176
 			'posts_per_page' => $args['count'] ? $args['count'] : -1,
177 177
 			'tax_query' => $taxQuery,
178
-		]);
179
-		return (object) [
178
+		] );
179
+		return (object)[
180 180
 			'results' => array_map( [$this, 'getReview'], $reviews->posts ),
181 181
 			'max_num_pages' => $reviews->max_num_pages,
182 182
 		];
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	public function getReviewsMeta( $keys, $status = 'publish' )
191 191
 	{
192 192
 		$keys = array_map( [$this, 'normalizeMetaKey'], (array)$keys );
193
-		if( $status == 'all' || empty( $status )) {
193
+		if( $status == 'all' || empty($status) ) {
194 194
 			$status = get_post_stati( ['exclude_from_search' => false] );
195 195
 		}
196 196
 		return glsr( SqlQueries::class )->getReviewsMeta( $keys, $status );
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
 			'fields' => 'id=>name',
207 207
 			'hide_empty' => false,
208 208
 			'taxonomy' => Application::TAXONOMY,
209
-		]);
210
-		unset( $args['count'] ); //we don't want a term count
209
+		] );
210
+		unset($args['count']); //we don't want a term count
211 211
 		$terms = get_terms( $args );
212
-		if( is_wp_error( $terms )) {
212
+		if( is_wp_error( $terms ) ) {
213 213
 			glsr_log()->error( $terms->get_error_message() );
214 214
 			return [];
215 215
 		}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 */
222 222
 	public function normalizeMeta( array $meta )
223 223
 	{
224
-		if( empty( $meta )) {
224
+		if( empty($meta) ) {
225 225
 			return [];
226 226
 		}
227 227
 		$defaults = wp_parse_args( $meta, [
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			'date' => '',
230 230
 			'review_id' => '',
231 231
 			'review_type' => '',
232
-		]);
232
+		] );
233 233
 		return glsr( CreateReviewDefaults::class )->restrict( $defaults );
234 234
 	}
235 235
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	public function normalizeMetaKey( $metaKey )
241 241
 	{
242 242
 		$metaKey = strtolower( $metaKey );
243
-		if( in_array( $metaKey, ['id', 'type'] )) {
243
+		if( in_array( $metaKey, ['id', 'type'] ) ) {
244 244
 			$metaKey = 'review_'.$metaKey;
245 245
 		}
246 246
 		return $metaKey;
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	public function normalizeTerms( $termIds )
254 254
 	{
255 255
 		$terms = [];
256
-		$termIds = array_map( 'trim', explode( ',', $termIds ));
256
+		$termIds = array_map( 'trim', explode( ',', $termIds ) );
257 257
 		foreach( $termIds as $termId ) {
258 258
 			$term = term_exists( $termId, Application::TAXONOMY );
259
-			if( !isset( $term['term_id'] ))continue;
259
+			if( !isset($term['term_id']) )continue;
260 260
 			$terms[] = intval( $term['term_id'] );
261 261
 		}
262 262
 		return $terms;
@@ -270,13 +270,13 @@  discard block
 block discarded – undo
270 270
 	{
271 271
 		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return;
272 272
 		delete_post_meta( $postId, '_edit_last' );
273
-		$result = wp_update_post([
273
+		$result = wp_update_post( [
274 274
 			'ID' => $postId,
275 275
 			'post_content' => get_post_meta( $postId, 'content', true ),
276 276
 			'post_date' => get_post_meta( $postId, 'date', true ),
277 277
 			'post_title' => get_post_meta( $postId, 'title', true ),
278
-		]);
279
-		if( is_wp_error( $result )) {
278
+		] );
279
+		if( is_wp_error( $result ) ) {
280 280
 			glsr_log()->error( $result->get_error_message() );
281 281
 		}
282 282
 	}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 			'post_status' => 'publish',
292 292
 			'post_type' => 'any',
293 293
 		];
294
-		if( is_numeric( $searchTerm )) {
294
+		if( is_numeric( $searchTerm ) ) {
295 295
 			$args['post__in'] = [$searchTerm];
296 296
 		}
297 297
 		else {
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
 			ob_start();
311 311
 			glsr()->render( 'partials/editor/search-result', [
312 312
 				'ID' => get_the_ID(),
313
-				'permalink' => esc_url( (string) get_permalink() ),
313
+				'permalink' => esc_url( (string)get_permalink() ),
314 314
 				'title' => esc_attr( get_the_title() ),
315
-			]);
315
+			] );
316 316
 			$results .= ob_get_clean();
317 317
 		}
318 318
 		wp_reset_postdata();
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 	public function setReviewTerms( $postId, $termIds )
328 328
 	{
329 329
 		$terms = $this->normalizeTerms( $termIds );
330
-		if( empty( $terms ))return;
330
+		if( empty($terms) )return;
331 331
 		$result = wp_set_object_terms( $postId, $terms, Application::TAXONOMY );
332
-		if( is_wp_error( $result )) {
332
+		if( is_wp_error( $result ) ) {
333 333
 			glsr_log()->error( $result->get_error_message() );
334 334
 		}
335 335
 	}
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	protected function getNewPostStatus( array $review, $isBlacklisted )
342 342
 	{
343 343
 		$requireApprovalOption = glsr( OptionManager::class )->get( 'settings.general.require.approval' );
344
-		return $review['review_type'] == 'local' && ( $requireApprovalOption == 'yes' || $isBlacklisted )
344
+		return $review['review_type'] == 'local' && ($requireApprovalOption == 'yes' || $isBlacklisted)
345 345
 			? 'pending'
346 346
 			: 'publish';
347 347
 	}
Please login to merge, or discard this patch.