Passed
Push — master ( 4ae161...f566f3 )
by Paul
05:17
created
plugin/Modules/Html/Partials/SiteReviews.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 				'navigation' => $navigation,
51 51
 			],
52 52
 			'reviews' => $this->buildReviews(),
53
-		]);
53
+		] );
54 54
 	}
55 55
 
56 56
 	/**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		$generatedReview = [];
75 75
 		foreach( $review as $key => $value ) {
76 76
 			$method = glsr( Helper::class )->buildMethodName( $key, 'buildReview' );
77
-			if( !method_exists( $this, $method ))continue;
77
+			if( !method_exists( $this, $method ) )continue;
78 78
 			$generatedReview[$key] = $this->$method( $key, $value );
79 79
 		}
80 80
 		return (object)$generatedReview;
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 	protected function buildReviewAssignedTo( $key, $value )
89 89
 	{
90 90
 		if( !$this->isOptionEnabled( 'settings.reviews.assigned_links.enabled' )
91
-			|| empty( $value )
91
+			|| empty($value)
92 92
 		)return;
93
-		$post = get_post( intval( $value ));
94
-		if( !( $post instanceof WP_Post ))return;
93
+		$post = get_post( intval( $value ) );
94
+		if( !($post instanceof WP_Post) )return;
95 95
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
96 96
 			'href' => get_the_permalink( $post->ID ),
97
-		]);
97
+		] );
98 98
 		$permalink = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink );
99 99
 		return $this->wrap( $key, $permalink );
100 100
 	}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	protected function buildReviewAuthor( $key, $value )
108 108
 	{
109
-		if( $this->isHidden( $key ))return;
109
+		if( $this->isHidden( $key ) )return;
110 110
 		$prefix = !$this->isOptionEnabled( 'settings.reviews.avatars.enabled' )
111 111
 			? apply_filters( 'site-reviews/review/author/prefix', '—' )
112 112
 			: '';
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function buildReviewAvatar( $key, $value )
122 122
 	{
123
-		if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ))return;
123
+		if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ) )return;
124 124
 		$size = $this->getOption( 'settings.reviews.avatars.size', 36 );
125
-		return $this->wrap( $key, glsr( Builder::class )->img([
125
+		return $this->wrap( $key, glsr( Builder::class )->img( [
126 126
 			'src' => $value,
127 127
 			'height' => $size,
128 128
 			'width' => $size,
129
-		]));
129
+		] ) );
130 130
 	}
131 131
 
132 132
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	protected function buildReviewContent( $key, $value )
138 138
 	{
139 139
 		$text = $this->normalizeText( $value );
140
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
140
+		if( $this->isHiddenOrEmpty( $key, $text ) )return;
141 141
 		return $this->wrap( $key, $text );
142 142
 	}
143 143
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	protected function buildReviewDate( $key, $value )
150 150
 	{
151
-		if( $this->isHidden( $key ))return;
151
+		if( $this->isHidden( $key ) )return;
152 152
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
153 153
 		if( $dateFormat == 'relative' ) {
154 154
 			$date = glsr( Date::class )->relative( $value );
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			$format = $dateFormat == 'custom'
158 158
 				? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' )
159 159
 				: (string)get_option( 'date_format' );
160
-			$date = date_i18n( $format, strtotime( $value ));
160
+			$date = date_i18n( $format, strtotime( $value ) );
161 161
 		}
162 162
 		return $this->wrap( $key, $date );
163 163
 	}
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	protected function buildReviewRating( $key, $value )
171 171
 	{
172
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
172
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
173 173
 		$rating = glsr( Html::class )->buildPartial( 'star-rating', [
174 174
 			'rating' => $value,
175
-		]);
175
+		] );
176 176
 		return $this->wrap( $key, $rating );
177 177
 	}
178 178
 
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	protected function buildReviewResponse( $key, $value )
185 185
 	{
186
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
187
-		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
186
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
187
+		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) );
188 188
 		$text = $this->normalizeText( $value );
189 189
 		return $this->wrap( $key, '<p><strong>'.$title.'</strong></p>'.$text );
190 190
 	}
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	protected function buildReviewTitle( $key, $value )
198 198
 	{
199
-		if( $this->isHidden( $key ))return;
200
-		if( empty( $value )) {
199
+		if( $this->isHidden( $key ) )return;
200
+		if( empty($value) ) {
201 201
 			$value = __( 'No Title', 'site-reviews' );
202 202
 		}
203 203
 		return $this->wrap( $key, '<h3>'.$value.'</h3>' );
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	protected function generateSchema()
210 210
 	{
211
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
212
-		glsr( Schema::class )->store( glsr( Schema::class )->build( $this->args ));
211
+		if( !wp_validate_boolean( $this->args['schema'] ) )return;
212
+		glsr( Schema::class )->store( glsr( Schema::class )->build( $this->args ) );
213 213
 	}
214 214
 
215 215
 	/**
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
 	{
231 231
 		$limit = $this->getOption( 'settings.reviews.excerpt.length', 55 );
232 232
 		if( str_word_count( $text, 0 ) > $limit ) {
233
-			$words = array_keys( str_word_count( $text, 2 ));
234
-			$excerpt = ltrim( substr( $text, 0, $words[$limit] ));
235
-			$hiddenText = substr( $text, strlen( $excerpt ));
233
+			$words = array_keys( str_word_count( $text, 2 ) );
234
+			$excerpt = ltrim( substr( $text, 0, $words[$limit] ) );
235
+			$hiddenText = substr( $text, strlen( $excerpt ) );
236 236
 			$showMore = glsr( Builder::class )->span( $hiddenText, [
237 237
 				'class' => 'glsr-hidden glsr-hidden-text',
238 238
 				'data-show-less' => __( 'Show less', 'site-reviews' ),
239 239
 				'data-show-more' => __( 'Show more', 'site-reviews' ),
240
-			]);
240
+			] );
241 241
 			$text = $excerpt.$showMore;
242 242
 		}
243 243
 		return nl2br( $text );
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	protected function getOption( $path, $fallback = '' )
252 252
 	{
253
-		if( array_key_exists( $path, $this->options )) {
253
+		if( array_key_exists( $path, $this->options ) ) {
254 254
 			return $this->options[$path];
255 255
 		}
256 256
 		return $fallback;
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 */
264 264
 	protected function isHidden( $key, $path = '' )
265 265
 	{
266
-		$isOptionEnabled = !empty( $path )
266
+		$isOptionEnabled = !empty($path)
267 267
 			? $this->isOptionEnabled( $path )
268 268
 			: true;
269 269
 		return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled;
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	protected function isHiddenOrEmpty( $key, $value )
278 278
 	{
279
-		return $this->isHidden( $key ) || empty( $value );
279
+		return $this->isHidden( $key ) || empty($value);
280 280
 	}
281 281
 
282 282
 	/**
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 	protected function normalizeText( $text )
296 296
 	{
297 297
 		$text = wp_kses( $text, wp_kses_allowed_html() );
298
-		$text = convert_smilies( wptexturize( strip_shortcodes( $text )));
298
+		$text = convert_smilies( wptexturize( strip_shortcodes( $text ) ) );
299 299
 		$text = str_replace( ']]>', ']]&gt;', $text );
300 300
 		$text = preg_replace( '/(\R){2,}/', '$1', $text );
301 301
 		$text = $this->isOptionEnabled( 'settings.reviews.excerpt.enabled' )
@@ -313,6 +313,6 @@  discard block
 block discarded – undo
313 313
 	{
314 314
 		return glsr( Builder::class )->div( $value, [
315 315
 			'class' => 'glsr-review-'.$key,
316
-		]);
316
+		] );
317 317
 	}
318 318
 }
Please login to merge, or discard this patch.