Passed
Branch hotfix/fix-counts (4b43d1)
by Paul
03:38
created
plugin/Shortcodes/SiteReviewsFormShortcode.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@
 block discarded – undo
25 25
 	public function normalizeAtts( $atts, $type = 'shortcode' )
26 26
 	{
27 27
 		$atts = parent::normalizeAtts( $atts, $type );
28
-		if( empty( $atts['id'] )) {
29
-			$atts['id'] = substr( md5( serialize( $atts )), 0, 8 );
28
+		if( empty($atts['id']) ) {
29
+			$atts['id'] = substr( md5( serialize( $atts ) ), 0, 8 );
30 30
 		}
31 31
 		return $atts;
32 32
 	}
Please login to merge, or discard this patch.
plugin/Shortcodes/Shortcode.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		$args = $this->normalizeArgs( $args, $type );
33 33
 		$atts = $this->normalizeAtts( $atts, $type );
34 34
 		$partial = glsr( Partial::class )->build( $this->partialName, $atts );
35
-		$title = !empty( $atts['title'] )
35
+		$title = !empty($atts['title'])
36 36
 			? $args['before_title'].$atts['title'].$args['after_title']
37 37
 			: '';
38 38
 		$debug = sprintf( '<glsr-%1$s hidden data-atts=\'%2$s\'></glsr-%1$s>', $type, $atts['json'] );
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function getDefaults( $atts )
55 55
 	{
56
-		return glsr( $this->getShortcodeDefaultsClassName() )->restrict( wp_parse_args( $atts ));
56
+		return glsr( $this->getShortcodeDefaultsClassName() )->restrict( wp_parse_args( $atts ) );
57 57
 	}
58 58
 
59 59
 	/**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 			'after_widget' => '</div>',
113 113
 			'before_title' => '<h3 class="glsr-'.$type.'-title">',
114 114
 			'after_title' => '</h3>',
115
-		]);
115
+		] );
116 116
 		return apply_filters( 'site-reviews/shortcode/args', $args, $type, $this->partialName );
117 117
 	}
118 118
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		$atts = $this->getDefaults( $atts );
128 128
 		array_walk( $atts, function( &$value, $key ) {
129 129
 			$methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' );
130
-			if( !method_exists( $this, $methodName ))return;
130
+			if( !method_exists( $this, $methodName ) )return;
131 131
 			$value = $this->$methodName( $value );
132 132
 		});
133 133
 		return $atts;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	protected function normalizeAssignedTo( $postId )
146 146
 	{
147 147
 		if( $postId == 'parent_id' ) {
148
-			$postId = intval( wp_get_post_parent_id( intval( get_the_ID() )));
148
+			$postId = intval( wp_get_post_parent_id( intval( get_the_ID() ) ) );
149 149
 		}
150 150
 		else if( $postId == 'post_id' ) {
151 151
 			$postId = intval( get_the_ID() );
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	protected function normalizeHide( $hide )
170 170
 	{
171
-		if( is_string( $hide )) {
171
+		if( is_string( $hide ) ) {
172 172
 			$hide = explode( ',', $hide );
173 173
 		}
174 174
 		$hideKeys = array_keys( $this->getHideOptions() );
175
-		return array_filter( array_map( 'trim', $hide ), function( $value ) use( $hideKeys ) {
175
+		return array_filter( array_map( 'trim', $hide ), function( $value ) use($hideKeys) {
176 176
 			return in_array( $value, $hideKeys );
177 177
 		});
178 178
 	}
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 			__( 'Terrible', 'site-reviews' ),
201 201
 		];
202 202
 		$defaults = array_pad( $defaults, glsr()->constant( 'MAX_RATING', Rating::class ), '' );
203
-		$labels = array_map( 'trim', explode( ',', $labels ));
203
+		$labels = array_map( 'trim', explode( ',', $labels ) );
204 204
 		foreach( $defaults as $i => $label ) {
205
-			if( empty( $labels[$i] ))continue;
205
+			if( empty($labels[$i]) )continue;
206 206
 			$defaults[$i] = $labels[$i];
207 207
 		}
208 208
 		return array_combine( range( glsr()->constant( 'MAX_RATING', Rating::class ), 1 ), $defaults );
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Pagination.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 				'loader' => '<div class="glsr-loader"></div>',
28 28
 				'screen_reader_text' => __( 'Site Reviews navigation', 'site-reviews' ),
29 29
 			],
30
-		]);
30
+		] );
31 31
 	}
32 32
 
33 33
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	{
38 38
 		$args = glsr( Style::class )->paginationArgs( $this->args );
39 39
 		if( is_front_page() ) {
40
-			unset( $args['format'] );
40
+			unset($args['format']);
41 41
 		}
42 42
 		if( $args['type'] == 'array' ) {
43 43
 			$args['type'] = 'plain';
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	protected function normalize( array $args )
52 52
 	{
53
-		if( $baseUrl = glsr_get( $args, 'baseUrl' )) {
53
+		if( $baseUrl = glsr_get( $args, 'baseUrl' ) ) {
54 54
 			$args['base'] = $baseUrl.'%_%';
55 55
 		}
56 56
 		return wp_parse_args( array_filter( $args ), [
57 57
 			'current' => glsr( QueryBuilder::class )->getPaged(),
58 58
 			'total' => 1,
59
-		]);
59
+		] );
60 60
 	}
61 61
 }
Please login to merge, or discard this patch.
plugin/Defaults/DefaultsAbstract.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function __call( $name, array $args = [] )
27 27
 	{
28
-		if( !method_exists( $this, $name ) || !in_array( $name, $this->callable ))return;
28
+		if( !method_exists( $this, $name ) || !in_array( $name, $this->callable ) )return;
29 29
 		$defaults = call_user_func_array( [$this, $name], $args );
30 30
 		$hookName = (new ReflectionClass( $this ))->getShortName();
31 31
 		$hookName = str_replace( 'Defaults', '', $hookName );
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	protected function filter( array $values = [] )
45 45
 	{
46
-		return $this->normalize( $this->merge( array_filter( $values )), $values );
46
+		return $this->normalize( $this->merge( array_filter( $values ) ), $values );
47 47
 	}
48 48
 
49 49
 	/**
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	protected function filteredJson( array $values = [] )
53 53
 	{
54 54
 		$defaults = $this->flattenArray(
55
-			array_diff_key( $this->defaults(), array_flip( $this->guarded ))
55
+			array_diff_key( $this->defaults(), array_flip( $this->guarded ) )
56 56
 		);
57 57
 		$values = $this->flattenArray(
58 58
 			shortcode_atts( $defaults, $values )
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		$filtered = array_filter( array_diff_assoc( $values, $defaults ), function( $value ) {
61 61
 			return !$this->isEmpty( $value );
62 62
 		});
63
-		return json_encode( $filtered, JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE );
63
+		return json_encode( $filtered, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
64 64
 	}
65 65
 
66 66
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	protected function flattenArray( array $values )
70 70
 	{
71 71
 		array_walk( $values, function( &$value ) {
72
-			if( !is_array( $value ))return;
72
+			if( !is_array( $value ) )return;
73 73
 			$value = implode( ',', $value );
74 74
 		});
75 75
 		return $values;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	protected function isEmpty( $var )
83 83
 	{
84
-		return !is_numeric( $var ) && !is_bool( $var ) && empty( $var );
84
+		return !is_numeric( $var ) && !is_bool( $var ) && empty($var);
85 85
 	}
86 86
 
87 87
 	/**
Please login to merge, or discard this patch.
plugin/Controllers/AjaxController.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function routerChangeStatus( array $request )
25 25
 	{
26
-		wp_send_json_success( $this->execute( new ChangeStatus( $request )));
26
+		wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) );
27 27
 	}
28 28
 
29 29
 	/**
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 	public function routerClearConsole()
33 33
 	{
34 34
 		glsr( AdminController::class )->routerClearConsole();
35
-		wp_send_json_success([
35
+		wp_send_json_success( [
36 36
 			'console' => glsr( Console::class )->get(),
37 37
 			'notices' => glsr( Notice::class )->get(),
38
-		]);
38
+		] );
39 39
 	}
40 40
 
41 41
 	/**
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	public function routerCountReviews()
45 45
 	{
46 46
 		glsr( AdminController::class )->routerCountReviews();
47
-		wp_send_json_success([
47
+		wp_send_json_success( [
48 48
 			'notices' => glsr( Notice::class )->get(),
49
-		]);
49
+		] );
50 50
 	}
51 51
 
52 52
 	/**
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 	{
57 57
 		$shortcode = $request['shortcode'];
58 58
 		$response = false;
59
-		if( array_key_exists( $shortcode, glsr()->mceShortcodes )) {
59
+		if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) {
60 60
 			$data = glsr()->mceShortcodes[$shortcode];
61
-			if( !empty( $data['errors'] )) {
61
+			if( !empty($data['errors']) ) {
62 62
 				$data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )];
63 63
 			}
64 64
 			$response = [
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 	public function routerFetchConsole()
79 79
 	{
80 80
 		glsr( AdminController::class )->routerFetchConsole();
81
-		wp_send_json_success([
81
+		wp_send_json_success( [
82 82
 			'console' => glsr( Console::class )->get(),
83 83
 			'notices' => glsr( Notice::class )->get(),
84
-		]);
84
+		] );
85 85
 	}
86 86
 
87 87
 	/**
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	public function routerSearchPosts( array $request )
91 91
 	{
92 92
 		$results = glsr( Database::class )->searchPosts( $request['search'] );
93
-		wp_send_json_success([
93
+		wp_send_json_success( [
94 94
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
95 95
 			'items' => $results,
96
-		]);
96
+		] );
97 97
 	}
98 98
 
99 99
 	/**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function routerSearchTranslations( array $request )
103 103
 	{
104
-		if( empty( $request['exclude'] )) {
104
+		if( empty($request['exclude']) ) {
105 105
 			$request['exclude'] = [];
106 106
 		}
107 107
 		$results = glsr( Translation::class )
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 			->exclude()
110 110
 			->exclude( $request['exclude'] )
111 111
 			->renderResults();
112
-		wp_send_json_success([
112
+		wp_send_json_success( [
113 113
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
114 114
 			'items' => $results,
115
-		]);
115
+		] );
116 116
 	}
117 117
 
118 118
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	public function routerSubmitReview( array $request )
122 122
 	{
123 123
 		$command = glsr( PublicController::class )->routerSubmitReview( $request );
124
-		$redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true )));
124
+		$redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) );
125 125
 		$redirect = apply_filters( 'site-reviews/review/redirect', $redirect, $command );
126 126
 		$data = [
127 127
 			'errors' => glsr( Session::class )->get( $command->form_id.'errors', false, true ),
@@ -145,16 +145,16 @@  discard block
 block discarded – undo
145 145
 		parse_str( parse_url( glsr_get( $request, 'url' ), PHP_URL_QUERY ), $urlQuery );
146 146
 		$args = [
147 147
 			'paged' => glsr_get( $urlQuery, glsr()->constant( 'PAGED_QUERY_VAR' ), 1 ),
148
-			'pagedUrl' => home_url( parse_url( glsr_get( $request, 'url' ), PHP_URL_PATH )),
148
+			'pagedUrl' => home_url( parse_url( glsr_get( $request, 'url' ), PHP_URL_PATH ) ),
149 149
 			'pagination' => 'ajax',
150 150
 			'schema' => false,
151 151
 		];
152
-		$atts = (array) json_decode( glsr_get( $request, 'atts' ));
153
-		$html = glsr( SiteReviews::class )->build( wp_parse_args( $args, $atts ));
154
-		return wp_send_json_success([
152
+		$atts = (array)json_decode( glsr_get( $request, 'atts' ) );
153
+		$html = glsr( SiteReviews::class )->build( wp_parse_args( $args, $atts ) );
154
+		return wp_send_json_success( [
155 155
 			'pagination' => $html->getPagination(),
156 156
 			'reviews' => $html->getReviews(),
157
-		]);
157
+		] );
158 158
 	}
159 159
 
160 160
 	/**
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function routerTogglePinned( array $request )
164 164
 	{
165
-		$isPinned = $this->execute( new TogglePinned( $request ));
166
-		wp_send_json_success([
165
+		$isPinned = $this->execute( new TogglePinned( $request ) );
166
+		wp_send_json_success( [
167 167
 			'notices' => glsr( Notice::class )->get(),
168 168
 			'pinned' => $isPinned,
169
-		]);
169
+		] );
170 170
 	}
171 171
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviews.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function generateSchema()
96 96
 	{
97
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
97
+		if( !wp_validate_boolean( $this->args['schema'] ) )return;
98 98
 		glsr( Schema::class )->store(
99 99
 			glsr( Schema::class )->build( $this->args )
100 100
 		);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function isHidden( $key, $path = '' )
109 109
 	{
110
-		$isOptionEnabled = !empty( $path )
110
+		$isOptionEnabled = !empty($path)
111 111
 			? $this->isOptionEnabled( $path )
112 112
 			: true;
113 113
 		return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled;
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function buildOptionAssignedTo( $key, $value )
122 122
 	{
123
-		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return;
123
+		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ) )return;
124 124
 		$post = glsr( Polylang::class )->getPost( $value );
125
-		if( !( $post instanceof WP_Post ))return;
125
+		if( !($post instanceof WP_Post) )return;
126 126
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
127 127
 			'href' => get_the_permalink( $post->ID ),
128
-		]);
128
+		] );
129 129
 		$assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink );
130 130
 		return '<span>'.$assignedTo.'</span>';
131 131
 	}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	protected function buildOptionAuthor( $key, $value )
139 139
 	{
140
-		if( $this->isHidden( $key ))return;
140
+		if( $this->isHidden( $key ) )return;
141 141
 		return '<span>'.$value.'</span>';
142 142
 	}
143 143
 
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	protected function buildOptionAvatar( $key, $value )
150 150
 	{
151
-		if( $this->isHidden( $key, 'settings.reviews.avatars' ))return;
151
+		if( $this->isHidden( $key, 'settings.reviews.avatars' ) )return;
152 152
 		$size = $this->getOption( 'settings.reviews.avatars_size', 40 );
153
-		return glsr( Builder::class )->img([
153
+		return glsr( Builder::class )->img( [
154 154
 			'height' => $size,
155 155
 			'src' => $this->generateAvatar( $value ),
156 156
 			'style' => sprintf( 'width:%1$spx; height:%1$spx;', $size ),
157 157
 			'width' => $size,
158
-		]);
158
+		] );
159 159
 	}
160 160
 
161 161
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	protected function buildOptionContent( $key, $value )
167 167
 	{
168 168
 		$text = $this->normalizeText( $value );
169
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
169
+		if( $this->isHiddenOrEmpty( $key, $text ) )return;
170 170
 		return '<p>'.$text.'</p>';
171 171
 	}
172 172
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	protected function buildOptionDate( $key, $value )
179 179
 	{
180
-		if( $this->isHidden( $key ))return;
180
+		if( $this->isHidden( $key ) )return;
181 181
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
182 182
 		if( $dateFormat == 'relative' ) {
183 183
 			$date = glsr( Date::class )->relative( $value );
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 			$format = $dateFormat == 'custom'
187 187
 				? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' )
188 188
 				: (string)get_option( 'date_format' );
189
-			$date = date_i18n( $format, strtotime( $value ));
189
+			$date = date_i18n( $format, strtotime( $value ) );
190 190
 		}
191 191
 		return '<span>'.$date.'</span>';
192 192
 	}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	protected function buildOptionRating( $key, $value )
200 200
 	{
201
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
201
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
202 202
 		return glsr_star_rating( $value );
203 203
 	}
204 204
 
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function buildOptionResponse( $key, $value )
211 211
 	{
212
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
213
-		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
212
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
213
+		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) );
214 214
 		$text = $this->normalizeText( $value );
215 215
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
216 216
 		$response = glsr( Builder::class )->div( $text, ['class' => 'glsr-review-response-inner'] );
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	protected function buildOptionTitle( $key, $value )
227 227
 	{
228
-		if( $this->isHidden( $key ))return;
229
-		if( empty( $value )) {
228
+		if( $this->isHidden( $key ) )return;
229
+		if( empty($value) ) {
230 230
 			$value = __( 'No Title', 'site-reviews' );
231 231
 		}
232 232
 		return '<h3>'.$value.'</h3>';
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 			return $avatarUrl;
243 243
 		}
244 244
 		$authorIdOrEmail = get_the_author_meta( 'ID', $this->current->user_id );
245
-		if( empty( $authorIdOrEmail )) {
245
+		if( empty($authorIdOrEmail) ) {
246 246
 			$authorIdOrEmail = $this->current->email;
247 247
 		}
248
-		if( $newAvatar = get_avatar_url( $authorIdOrEmail )) {
248
+		if( $newAvatar = get_avatar_url( $authorIdOrEmail ) ) {
249 249
 			return $newAvatar;
250 250
 		}
251 251
 		return $avatarUrl;
@@ -257,18 +257,18 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	protected function getExcerpt( $text )
259 259
 	{
260
-		$limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ));
260
+		$limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ) );
261 261
 		$split = extension_loaded( 'intl' )
262 262
 			? $this->getExcerptIntlSplit( $text, $limit )
263 263
 			: $this->getExcerptSplit( $text, $limit );
264 264
 		$hiddenText = substr( $text, $split );
265
-		if( !empty( $hiddenText )) {
265
+		if( !empty($hiddenText) ) {
266 266
 			$showMore = glsr( Builder::class )->span( $hiddenText, [
267 267
 				'class' => 'glsr-hidden glsr-hidden-text',
268 268
 				'data-show-less' => __( 'Show less', 'site-reviews' ),
269 269
 				'data-show-more' => __( 'Show more', 'site-reviews' ),
270
-			]);
271
-			$text = ltrim( substr( $text, 0, $split )).$showMore;
270
+			] );
271
+			$text = ltrim( substr( $text, 0, $split ) ).$showMore;
272 272
 		}
273 273
 		return $text;
274 274
 	}
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		$words = IntlRuleBasedBreakIterator::createWordInstance( '' );
284 284
 		$words->setText( $text );
285 285
 		$count = 0;
286
-		foreach( $words as $offset ){
286
+		foreach( $words as $offset ) {
287 287
 			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
288 288
 			$count++;
289 289
 			if( $count != $limit )continue;
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	protected function getExcerptSplit( $text, $limit )
301 301
 	{
302 302
 		if( str_word_count( $text, 0 ) > $limit ) {
303
-			$words = array_keys( str_word_count( $text, 2 ));
303
+			$words = array_keys( str_word_count( $text, 2 ) );
304 304
 			return $words[$limit];
305 305
 		}
306 306
 		return strlen( $text );
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 */
314 314
 	protected function getOption( $path, $fallback = '' )
315 315
 	{
316
-		if( array_key_exists( $path, $this->options )) {
316
+		if( array_key_exists( $path, $this->options ) ) {
317 317
 			return $this->options[$path];
318 318
 		}
319 319
 		return $fallback;
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	 */
327 327
 	protected function isHiddenOrEmpty( $key, $value )
328 328
 	{
329
-		return $this->isHidden( $key ) || empty( $value );
329
+		return $this->isHidden( $key ) || empty($value);
330 330
 	}
331 331
 
332 332
 	/**
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
 	protected function normalizeText( $text )
346 346
 	{
347 347
 		$text = wp_kses( $text, wp_kses_allowed_html() );
348
-		$text = convert_smilies( strip_shortcodes( $text ));
348
+		$text = convert_smilies( strip_shortcodes( $text ) );
349 349
 		$text = str_replace( ']]>', ']]&gt;', $text );
350 350
 		$text = preg_replace( '/(\R){2,}/', '$1', $text );
351
-		if( $this->isOptionEnabled( 'settings.reviews.excerpts' )) {
351
+		if( $this->isOptionEnabled( 'settings.reviews.excerpts' ) ) {
352 352
 			$text = $this->getExcerpt( $text );
353 353
 		}
354
-		return wptexturize( nl2br( $text ));
354
+		return wptexturize( nl2br( $text ) );
355 355
 	}
356 356
 
357 357
 	/**
@@ -360,12 +360,12 @@  discard block
 block discarded – undo
360 360
 	protected function wrap( array &$renderedFields, Review $review )
361 361
 	{
362 362
 		$renderedFields = apply_filters( 'site-reviews/review/wrap', $renderedFields, $review );
363
-		array_walk( $renderedFields, function( &$value, $key ) use( $review ) {
363
+		array_walk( $renderedFields, function( &$value, $key ) use($review) {
364 364
 			$value = apply_filters( 'site-reviews/review/wrap/'.$key, $value, $review );
365
-			if( empty( $value ))return;
365
+			if( empty($value) )return;
366 366
 			$value = glsr( Builder::class )->div( $value, [
367 367
 				'class' => 'glsr-review-'.$key,
368
-			]);
368
+			] );
369 369
 		});
370 370
 	}
371 371
 }
Please login to merge, or discard this patch.
helpers.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		'glsr_star_rating' => 2,
21 21
 	);
22 22
 	foreach( $hooks as $function => $acceptedArgs ) {
23
-		add_filter( $function, function() use( $function ) {
23
+		add_filter( $function, function() use($function) {
24 24
 			$args = func_get_args();
25 25
 			array_shift( $args ); // remove the fallback value
26 26
 			return call_user_func_array( $function, $args );
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function glsr( $alias = null ) {
35 35
 	$app = \GeminiLabs\SiteReviews\Application::load();
36
-	return !empty( $alias )
36
+	return !empty($alias)
37 37
 		? $app->make( $alias )
38 38
 		: $app;
39 39
 }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	$result = array();
48 48
 	foreach( $array as $subarray ) {
49 49
 		$subarray = (array)$subarray;
50
-		if( !isset( $subarray[$column] ))continue;
50
+		if( !isset($subarray[$column]) )continue;
51 51
 		$result[] = $subarray[$column];
52 52
 	}
53 53
 	return $result;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
  */
59 59
 function glsr_calculate_ratings() {
60 60
 	glsr( 'Controllers\AdminController' )->routerCountReviews( false );
61
-	glsr_log()->notice( __( 'Recalculated rating counts.', 'site-reviews' ));
61
+	glsr_log()->notice( __( 'Recalculated rating counts.', 'site-reviews' ) );
62 62
 }
63 63
 
64 64
 /**
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
  * @return \WP_Screen|object
76 76
  */
77 77
 function glsr_current_screen() {
78
-	if( function_exists( 'get_current_screen' )) {
78
+	if( function_exists( 'get_current_screen' ) ) {
79 79
 		$screen = get_current_screen();
80 80
 	}
81
-	return empty( $screen )
81
+	return empty($screen)
82 82
 		? (object)array_fill_keys( ['base', 'id', 'post_type'], null )
83 83
 		: $screen;
84 84
 }
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function glsr_get_review( $post_id ) {
137 137
 	$post = null;
138
-	if( is_numeric( $post_id )) {
138
+	if( is_numeric( $post_id ) ) {
139 139
 		$post = get_post( $post_id );
140 140
 	}
141
-	if( !( $post instanceof WP_Post )) {
141
+	if( !($post instanceof WP_Post) ) {
142 142
 		$post = new WP_Post( (object)[] );
143 143
 	}
144 144
 	return glsr( 'Database\ReviewManager' )->single( $post );
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
  * @return array
149 149
  */
150 150
 function glsr_get_reviews( $args = array() ) {
151
-	return glsr( 'Database\ReviewManager' )->get( glsr( 'Helper' )->consolidateArray( $args ));
151
+	return glsr( 'Database\ReviewManager' )->get( glsr( 'Helper' )->consolidateArray( $args ) );
152 152
 }
153 153
 
154 154
 /**
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 function glsr_log() {
158 158
 	$args = func_get_args();
159 159
 	$console = glsr( 'Modules\Console' );
160
-	if( $value = glsr_get( $args, '0' )) {
161
-		return $console->debug( $value, glsr_get( $args, '1', [] ));
160
+	if( $value = glsr_get( $args, '0' ) ) {
161
+		return $console->debug( $value, glsr_get( $args, '1', [] ) );
162 162
 	}
163 163
 	return $console;
164 164
 }
Please login to merge, or discard this patch.
plugin/Reviews.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		$this->args = $args;
30 30
 		$this->max_num_pages = $maxPageCount;
31 31
 		$this->reviews = $reviews;
32
-		parent::__construct( $reviews, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS );
32
+		parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
33 33
 	}
34 34
 
35 35
 	/**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @return mixed
55 55
 	 */
56 56
 	public function offsetGet( $key ) {
57
-		if( property_exists( $this, $key )) {
57
+		if( property_exists( $this, $key ) ) {
58 58
 			return $this->{$key};
59 59
 		}
60 60
 		return array_key_exists( $key, $this->reviews )
Please login to merge, or discard this patch.
plugin/Review.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function build( array $args = [] )
70 70
 	{
71
-		if( empty( $this->ID )) {
71
+		if( empty($this->ID) ) {
72 72
 			return new ReviewHtml( $this );
73 73
 		}
74 74
 		$partial = glsr( SiteReviewsPartial::class );
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function offsetGet( $key )
94 94
 	{
95
-		if( property_exists( $this, $key )) {
95
+		if( property_exists( $this, $key ) ) {
96 96
 			return $this->{$key};
97 97
 		}
98 98
 		return array_key_exists( $key, (array)$this->custom )
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function offsetSet( $key, $value )
109 109
 	{
110
-		if( property_exists( $this, $key )) {
110
+		if( property_exists( $this, $key ) ) {
111 111
 			$this->{$key} = $value;
112 112
 			return;
113 113
 		}
114
-		if( !is_array( $this->custom )) {
114
+		if( !is_array( $this->custom ) ) {
115 115
 			$this->custom = array_filter( (array)$this->custom );
116 116
 		}
117 117
 		$this->custom[$key] = $value;
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
 			'review_type' => 'local',
157 157
 		];
158 158
 		$meta = array_filter(
159
-			array_map( 'array_shift', array_filter((array)get_post_meta( $post->ID ))),
159
+			array_map( 'array_shift', array_filter( (array)get_post_meta( $post->ID ) ) ),
160 160
 			'strlen'
161 161
 		);
162
-		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
162
+		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) );
163 163
 		$this->modified = $this->isModified( $properties );
164 164
 		array_walk( $properties, function( $value, $key ) {
165
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
165
+			if( !property_exists( $this, $key ) || isset($this->$key) )return;
166 166
 			$this->$key = maybe_unserialize( $value );
167 167
 		});
168 168
 	}
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	protected function setTermIds( WP_Post $post )
174 174
 	{
175 175
 		$this->term_ids = [];
176
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
176
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return;
177 177
 		foreach( $terms as $term ) {
178 178
 			$this->term_ids[] = $term->term_id;
179 179
 		}
Please login to merge, or discard this patch.