Passed
Push — master ( 7f2931...8eca98 )
by Paul
08:06 queued 03:49
created
plugin/Controllers/MenuController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 	{
23 23
 		global $menu, $typenow;
24 24
 		foreach( $menu as $key => $value ) {
25
-			if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue;
25
+			if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue;
26 26
 			$postCount = wp_count_posts( Application::POST_TYPE );
27 27
 			$pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [
28 28
 				'class' => 'pending-count',
29
-			]);
29
+			] );
30 30
 			$awaitingModeration = glsr( Builder::class )->span( $pendingCount, [
31 31
 				'class' => 'awaiting-mod count-'.$postCount->pending,
32
-			]);
32
+			] );
33 33
 			$menu[$key][0] .= ' '.$awaitingModeration;
34 34
 			if( $typenow === Application::POST_TYPE ) {
35
-				$menu[$key][4].= ' current';
35
+				$menu[$key][4] .= ' current';
36 36
 			}
37 37
 			break;
38 38
 		}
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 			'tools' => __( 'Tools', 'site-reviews' ),
50 50
 			'addons' => __( 'Add-ons', 'site-reviews' ),
51 51
 			'documentation' => __( 'Documentation', 'site-reviews' ),
52
-		]);
52
+		] );
53 53
 		foreach( $pages as $slug => $title ) {
54 54
 			$method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' );
55 55
 			$callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug );
56
-			if( !is_callable( $callback ))continue;
56
+			if( !is_callable( $callback ) )continue;
57 57
 			add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->constant( 'CAPABILITY' ), $slug, $callback );
58 58
 		}
59 59
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	{
68 68
 		$this->renderPage( 'addons', [
69 69
 			'template' => glsr( Template::class ),
70
-		]);
70
+		] );
71 71
 	}
72 72
 
73 73
 	/**
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
 			'hooks' => __( 'Hooks', 'site-reviews' ),
85 85
 			'functions' => __( 'Functions', 'site-reviews' ),
86 86
 			'addons' => __( 'Addons', 'site-reviews' ),
87
-		]);
87
+		] );
88 88
 		$addons = apply_filters( 'site-reviews/addon/documentation', [] );
89 89
 		ksort( $addons );
90
-		if( empty( $addons )) {
91
-			unset( $tabs['addons'] );
90
+		if( empty($addons) ) {
91
+			unset($tabs['addons']);
92 92
 		}
93 93
 		$this->renderPage( 'documentation', [
94 94
 			'addons' => $addons,
95 95
 			'tabs' => $tabs,
96
-		]);
96
+		] );
97 97
 	}
98 98
 
99 99
 	/**
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 			'translations' => __( 'Translations', 'site-reviews' ),
112 112
 			'addons' => __( 'Addons', 'site-reviews' ),
113 113
 			'licenses' => __( 'Licenses', 'site-reviews' ),
114
-		]);
115
-		if( empty( glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults ))) {
116
-			unset( $tabs['addons'] );
114
+		] );
115
+		if( empty(glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults )) ) {
116
+			unset($tabs['addons']);
117 117
 		}
118
-		if( empty( glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults ))) {
119
-			unset( $tabs['licenses'] );
118
+		if( empty(glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults )) ) {
119
+			unset($tabs['licenses']);
120 120
 		}
121 121
 		$this->renderPage( 'settings', [
122 122
 			'notices' => $this->getNotices(),
123 123
 			'settings' => glsr( Settings::class ),
124 124
 			'tabs' => $tabs,
125
-		]);
125
+		] );
126 126
 	}
127 127
 
128 128
 	/**
@@ -137,24 +137,24 @@  discard block
 block discarded – undo
137 137
 			'sync' => __( 'Sync Reviews', 'site-reviews' ),
138 138
 			'console' => __( 'Console', 'site-reviews' ),
139 139
 			'system-info' => __( 'System Info', 'site-reviews' ),
140
-		]);
141
-		if( !apply_filters( 'site-reviews/addon/sync/enable', false )) {
142
-			unset( $tabs['sync'] );
140
+		] );
141
+		if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) {
142
+			unset($tabs['sync']);
143 143
 		}
144 144
 		$this->renderPage( 'tools', [
145 145
 			'data' => [
146 146
 				'context' => [
147 147
 					'base_url' => admin_url( 'edit.php?post_type='.Application::POST_TYPE ),
148
-					'console' => strval( glsr( Console::class )),
148
+					'console' => strval( glsr( Console::class ) ),
149 149
 					'id' => Application::ID,
150
-					'system' => strval( glsr( System::class )),
150
+					'system' => strval( glsr( System::class ) ),
151 151
 				],
152 152
 				'services' => apply_filters( 'site-reviews/addon/sync/services', [] ),
153 153
 			],
154 154
 			'notices' => $this->getNotices(),
155 155
 			'tabs' => $tabs,
156 156
 			'template' => glsr( Template::class ),
157
-		]);
157
+		] );
158 158
 	}
159 159
 
160 160
 	/**
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	{
176 176
 		return glsr( Builder::class )->div( glsr( Notice::class )->get(), [
177 177
 			'id' => 'glsr-notices',
178
-		]);
178
+		] );
179 179
 	}
180 180
 
181 181
 	/**
Please login to merge, or discard this patch.
plugin/Handlers/ChangeStatus.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	public function handle( Command $command )
15 15
 	{
16
-		$postId = wp_update_post([
16
+		$postId = wp_update_post( [
17 17
 			'ID' => $command->id,
18 18
 			'post_status' => $command->status,
19
-		]);
20
-		if( is_wp_error( $postId )) {
19
+		] );
20
+		if( is_wp_error( $postId ) ) {
21 21
 			glsr_log()->error( $postId->get_error_message() );
22 22
 			return [];
23 23
 		}
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 			'aria-label' => '“'.esc_attr( $title ).'” ('.__( 'Edit', 'site-reviews' ).')',
40 40
 			'class' => 'row-title',
41 41
 			'href' => get_edit_post_link( $postId ),
42
-		]);
42
+		] );
43 43
 	}
44 44
 
45 45
 	/**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	protected function getPostState( $postId )
50 50
 	{
51 51
 		ob_start();
52
-		_post_states( get_post( $postId ));
52
+		_post_states( get_post( $postId ) );
53 53
 		return ob_get_clean();
54 54
 	}
55 55
 
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 	protected function getStatusLinks()
60 60
 	{
61 61
 		global $avail_post_stati;
62
-		require_once( ABSPATH.'wp-admin/includes/class-wp-posts-list-table.php' );
62
+		require_once(ABSPATH.'wp-admin/includes/class-wp-posts-list-table.php');
63 63
 		$hookName = 'edit-'.Application::POST_TYPE;
64 64
 		set_current_screen( $hookName );
65 65
 		$avail_post_stati = get_available_post_statuses( Application::POST_TYPE );
66 66
 		$table = new \WP_Posts_List_Table( ['screen' => $hookName] );
67 67
 		$views = apply_filters( 'views_'.$hookName, $table->get_views() ); // uses compat get_views()
68
-		if( empty( $views ))return;
68
+		if( empty($views) )return;
69 69
 		foreach( $views as $class => $view ) {
70 70
 			$views[$class] = "\t<li class='$class'>$view";
71 71
 		}
Please login to merge, or discard this patch.
plugin/Modules/System.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 			'setting' => 'Plugin Settings',
41 41
 			'reviews' => 'Review Counts',
42 42
 		];
43
-		$systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use( $details ) {
43
+		$systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use($details) {
44 44
 			$methodName = glsr( Helper::class )->buildMethodName( 'get-'.$key.'-details' );
45 45
 			if( method_exists( $this, $methodName ) && $systemDetails = $this->$methodName() ) {
46 46
 				return $carry.$this->implode(
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	{
61 61
 		$plugins = get_plugins();
62 62
 		$activePlugins = (array)get_option( 'active_plugins', [] );
63
-		$inactive = array_diff_key( $plugins, array_flip( $activePlugins ));
64
-		return $this->normalizePluginList( array_diff_key( $plugins, $inactive ));
63
+		$inactive = array_diff_key( $plugins, array_flip( $activePlugins ) );
64
+		return $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
65 65
 	}
66 66
 
67 67
 	/**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	public function getInactivePluginDetails()
96 96
 	{
97 97
 		$activePlugins = (array)get_option( 'active_plugins', [] );
98
-		return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins )));
98
+		return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) );
99 99
 	}
100 100
 
101 101
 	/**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	{
106 106
 		$plugins = array_merge(
107 107
 			get_mu_plugins(),
108
-			get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ))
108
+			get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ) )
109 109
 		);
110
-		if( empty( $plugins ))return;
110
+		if( empty($plugins) )return;
111 111
 		return $this->normalizePluginList( $plugins );
112 112
 	}
113 113
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function getMultisitePluginDetails()
118 118
 	{
119
-		if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return;
119
+		if( !is_multisite() || empty(get_site_option( 'active_sitewide_plugins', [] )) )return;
120 120
 		return $this->normalizePluginList( wp_get_active_network_plugins() );
121 121
 	}
122 122
 
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
 			'Max Input Vars' => ini_get( 'max_input_vars' ),
144 144
 			'Memory Limit' => ini_get( 'memory_limit' ),
145 145
 			'Post Max Size' => ini_get( 'post_max_size' ),
146
-			'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' )),
147
-			'Session Name' => esc_html( ini_get( 'session.name' )),
148
-			'Session Save Path' => esc_html( ini_get( 'session.save_path' )),
149
-			'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' )), true ),
150
-			'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' )), true ),
146
+			'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' ) ),
147
+			'Session Name' => esc_html( ini_get( 'session.name' ) ),
148
+			'Session Save Path' => esc_html( ini_get( 'session.save_path' ) ),
149
+			'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' ) ), true ),
150
+			'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' ) ), true ),
151 151
 			'Upload Max Filesize' => ini_get( 'upload_max_filesize' ),
152 152
 		];
153 153
 	}
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	{
160 160
 		$counts = glsr( CountsManager::class )->getCounts();
161 161
 		$counts = glsr( Helper::class )->flattenArray( $counts );
162
- 		array_walk( $counts, function( &$ratings ) use( $counts ) {
163
-			if( !is_array( $ratings )) {
162
+ 		array_walk( $counts, function( &$ratings ) use($counts) {
163
+			if( !is_array( $ratings ) ) {
164 164
 				glsr_log()
165 165
 					->error( '$ratings is not an array, possibly due to incorrectly imported reviews.' )
166 166
 					->debug( $ratings )
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
 		ksort( $settings );
200 200
 		$details = [];
201 201
 		foreach( $settings as $key => $value ) {
202
-			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue;
203
-			$value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' );
202
+			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ) )continue;
203
+			$value = htmlspecialchars( trim( preg_replace( '/\s\s+/', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' );
204 204
 			$details[$key] = $value;
205 205
 		}
206 206
 		return $details;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	{
214 214
 		return [
215 215
 			'Console size' => glsr( Console::class )->humanSize( '0' ),
216
-			'Last Rating Count' => date_i18n( 'Y-m-d H:i', glsr( OptionManager::class )->get( 'last_review_count' )),
216
+			'Last Rating Count' => date_i18n( 'Y-m-d H:i', glsr( OptionManager::class )->get( 'last_review_count' ) ),
217 217
 			'Version (current)' => glsr()->version,
218 218
 			'Version (previous)' => glsr( OptionManager::class )->get( 'version_upgraded_from' ),
219 219
 		];
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 			'WPE_APIKEY' => 'WP Engine',
274 274
 		];
275 275
 		foreach( $checks as $key => $value ) {
276
-			if( !$this->isWebhostCheckValid( $key ))continue;
276
+			if( !$this->isWebhostCheckValid( $key ) )continue;
277 277
 			return $value;
278 278
 		}
279
-		return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ));
279
+		return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ) );
280 280
 	}
281 281
 
282 282
 	/**
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	{
298 298
 		$plugins = get_plugins();
299 299
 		$activePlugins = (array)get_option( 'active_plugins', [] );
300
-		$inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins )));
301
-		$active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ));
300
+		$inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ) ) );
301
+		$active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
302 302
 		return $active + $inactive;
303 303
 	}
304 304
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	protected function implode( $title, array $details )
310 310
 	{
311 311
 		$strings = ['['.$title.']'];
312
-		$padding = max( array_map( 'strlen', array_keys( $details )) );
312
+		$padding = max( array_map( 'strlen', array_keys( $details ) ) );
313 313
 		$padding = max( [$padding, static::PAD] );
314 314
 		foreach( $details as $key => $value ) {
315 315
 			$strings[] = is_string( $key )
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
 		$keys = [
353 353
 			'licenses.', 'submissions.recaptcha.key', 'submissions.recaptcha.secret',
354 354
 		];
355
-		array_walk( $settings, function( &$value, $setting ) use( $keys ) {
355
+		array_walk( $settings, function( &$value, $setting ) use($keys) {
356 356
 			foreach( $keys as $key ) {
357
-				if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value ))continue;
357
+				if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty($value) )continue;
358 358
 				$value = str_repeat( '•', 13 );
359 359
 				return;
360 360
 			}
Please login to merge, or discard this patch.
compatibility.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
  * @see https://wordpress.org/plugins/wp-super-cache/
21 21
  */
22 22
 add_action( 'site-reviews/review/created', function( $review, $request ) {
23
-	if( !function_exists( 'wp_cache_post_change' ))return;
23
+	if( !function_exists( 'wp_cache_post_change' ) )return;
24 24
 	wp_cache_post_change( $request->post_id );
25
-	if( empty( $review->assigned_to ) || $review->assigned_to == $request->post_id )return;
25
+	if( empty($review->assigned_to) || $review->assigned_to == $request->post_id )return;
26 26
 	wp_cache_post_change( $review->assigned_to );
27 27
 }, 10, 2 );
28 28
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  */
34 34
 add_filter( 'sbp_exclude_defer_scripts', function( $scriptHandles ) {
35 35
 	$scriptHandles[] = 'site-reviews/google-recaptcha';
36
-	return array_keys( array_flip( $scriptHandles ));
36
+	return array_keys( array_flip( $scriptHandles ) );
37 37
 });
38 38
 
39 39
 /**
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
  * @see https://searchandfilter.com/
44 44
  */
45 45
 add_filter( 'sf_edit_query_args', function( $query ) {
46
-	if( !empty( $query['meta_key'] ) && $query['meta_key'] == '_glsr_ranking' ) {
47
-		unset( $query['meta_key'] );
46
+	if( !empty($query['meta_key']) && $query['meta_key'] == '_glsr_ranking' ) {
47
+		unset($query['meta_key']);
48 48
 		$query['meta_query'] = [
49 49
 			'relation' => 'OR',
50 50
 			['key' => '_glsr_ranking', 'compare' => 'EXISTS'],
Please login to merge, or discard this patch.
plugin/Modules/Upgrader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 			$className = str_replace( '.php', '', $file );
25 25
 			$version = str_replace( ['Upgrade_', '_'], ['', '.'], $className );
26 26
 			$versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions
27
-			if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return;
27
+			if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ) )return;
28 28
 			glsr( 'Modules\\Upgrader\\'.$className );
29 29
 			glsr_log()->info( 'Completed Upgrade for v'.$version.$versionSuffix );
30 30
 		});
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			$this->setReviewCounts();
42 42
 			$this->updateVersionFrom( $version );
43 43
 		}
44
-		else if( !glsr( OptionManager::class )->get( 'last_review_count', false )) {
44
+		else if( !glsr( OptionManager::class )->get( 'last_review_count', false ) ) {
45 45
 			$this->setReviewCounts();
46 46
 		}
47 47
 	}
Please login to merge, or discard this patch.
plugin/Modules/Validator.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		foreach( $this->rules as $attribute => $rules ) {
75 75
 			foreach( $rules as $rule ) {
76 76
 				$this->validateAttribute( $attribute, $rule );
77
-				if( $this->shouldStopValidating( $attribute ))break;
77
+				if( $this->shouldStopValidating( $attribute ) )break;
78 78
 			}
79 79
 		}
80 80
 		return $this->errors;
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function validateAttribute( $attribute, $rule )
91 91
 	{
92
-		list( $rule, $parameters ) = $this->parseRule( $rule );
92
+		list($rule, $parameters) = $this->parseRule( $rule );
93 93
 		if( $rule == '' )return;
94 94
 		$value = $this->getValue( $attribute );
95
-		if( !method_exists( $this, $method = 'validate'.$rule )) {
95
+		if( !method_exists( $this, $method = 'validate'.$rule ) ) {
96 96
 			throw new BadMethodCallException( "Method [$method] does not exist." );
97 97
 		}
98
-		if( !$this->$method( $value, $attribute, $parameters )) {
98
+		if( !$this->$method( $value, $attribute, $parameters ) ) {
99 99
 			$this->addFailure( $attribute, $rule, $parameters );
100 100
 		}
101 101
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	protected function getMessage( $attribute, $rule, array $parameters )
146 146
 	{
147
-		if( in_array( $rule, $this->sizeRules )) {
147
+		if( in_array( $rule, $this->sizeRules ) ) {
148 148
 			return $this->getSizeMessage( $attribute, $rule, $parameters );
149 149
 		}
150 150
 		$lowerRule = glsr( Helper::class )->snakeCase( $rule );
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	protected function getRule( $attribute, $rules )
161 161
 	{
162
-		if( !array_key_exists( $attribute, $this->rules ))return;
162
+		if( !array_key_exists( $attribute, $this->rules ) )return;
163 163
 		$rules = (array)$rules;
164 164
 		foreach( $this->rules[$attribute] as $rule ) {
165
-			list( $rule, $parameters ) = $this->parseRule( $rule );
166
-			if( in_array( $rule, $rules )) {
165
+			list($rule, $parameters) = $this->parseRule( $rule );
166
+			if( in_array( $rule, $rules ) ) {
167 167
 				return [$rule, $parameters];
168 168
 			}
169 169
 		}
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		if( is_numeric( $value ) && $hasNumeric ) {
182 182
 			return $value;
183 183
 		}
184
-		else if( is_array( $value )) {
184
+		else if( is_array( $value ) ) {
185 185
 			return count( $value );
186 186
 		}
187 187
 		return function_exists( 'mb_strlen' )
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function getValue( $attribute )
211 211
 	{
212
-		if( isset( $this->data[$attribute] )) {
212
+		if( isset($this->data[$attribute]) ) {
213 213
 			return $this->data[$attribute];
214 214
 		}
215 215
 	}
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	protected function hasRule( $attribute, $rules )
224 224
 	{
225
-		return !is_null( $this->getRule( $attribute, $rules ));
225
+		return !is_null( $this->getRule( $attribute, $rules ) );
226 226
 	}
227 227
 
228 228
 	/**
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	{
261 261
 		$parameters = [];
262 262
 		if( strpos( $rule, ':' ) !== false ) {
263
-			list( $rule, $parameter ) = explode( ':', $rule, 2 );
263
+			list($rule, $parameter) = explode( ':', $rule, 2 );
264 264
 			$parameters = $this->parseParameters( $rule, $parameter );
265 265
 		}
266 266
 		$rule = glsr( Helper::class )->camelCase( $rule );
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	protected function shouldStopValidating( $attribute )
290 290
 	{
291 291
 		return $this->hasRule( $attribute, $this->implicitRules )
292
-			&& isset( $this->failedRules[$attribute] )
292
+			&& isset($this->failedRules[$attribute])
293 293
 			&& array_intersect( array_keys( $this->failedRules[$attribute] ), $this->implicitRules );
294 294
 	}
295 295
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	protected function translator( $key, array $parameters )
303 303
 	{
304 304
 		$strings = glsr( ValidationStringsDefaults::class )->defaults();
305
-		if( isset( $strings[$key] )) {
305
+		if( isset($strings[$key]) ) {
306 306
 			return $this->replace( $strings[$key], $parameters );
307 307
 		}
308 308
 		return "error";
Please login to merge, or discard this patch.
plugin/Database/Cache.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 			$ipAddresses = array_fill_keys( ['v4', 'v6'], [] );
20 20
 			foreach( array_keys( $ipAddresses ) as $version ) {
21 21
 				$response = wp_remote_get( 'https://www.cloudflare.com/ips-'.$version );
22
-				if( is_wp_error( $response )) {
22
+				if( is_wp_error( $response ) ) {
23 23
 					glsr_log()->error( $response->get_error_message() );
24 24
 					continue;
25 25
 				}
26 26
 				$ipAddresses[$version] = array_filter(
27
-					(array)preg_split( '/\R/', wp_remote_retrieve_body( $response ))
27
+					(array)preg_split( '/\R/', wp_remote_retrieve_body( $response ) )
28 28
 				);
29 29
 			}
30 30
 			set_transient( Application::ID.'_cloudflare_ips', $ipAddresses, static::EXPIRY_TIME );
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		if( $test === false ) {
60 60
 			$response = wp_remote_post( 'https://api.wordpress.org/stats/php/1.0/' );
61 61
 			$test = !is_wp_error( $response )
62
-				&& in_array( $response['response']['code'], range( 200, 299 ))
62
+				&& in_array( $response['response']['code'], range( 200, 299 ) )
63 63
 				? 'Works'
64 64
 				: 'Does not work';
65 65
 			set_transient( Application::ID.'_remote_post_test', $test, static::EXPIRY_TIME );
Please login to merge, or discard this patch.
plugin/Database/DefaultsManager.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 	public function defaults()
14 14
 	{
15 15
 		$settings = $this->settings();
16
-		$defaults = array_combine( array_keys( $settings ), glsr_array_column( $settings, 'default' ));
16
+		$defaults = array_combine( array_keys( $settings ), glsr_array_column( $settings, 'default' ) );
17 17
 		return wp_parse_args( $defaults, [
18 18
 			'version' => '',
19 19
 			'version_upgraded_from' => '',
20
-		]);
20
+		] );
21 21
 	}
22 22
 
23 23
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function settings()
48 48
 	{
49
-		$settings = apply_filters( 'site-reviews/addon/settings', glsr()->config( 'settings' ));
49
+		$settings = apply_filters( 'site-reviews/addon/settings', glsr()->config( 'settings' ) );
50 50
 		return $this->normalize( $settings );
51 51
 	}
52 52
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	protected function normalize( array $settings )
57 57
 	{
58 58
 		array_walk( $settings, function( &$setting ) {
59
-			if( isset( $setting['default'] ))return;
59
+			if( isset($setting['default']) )return;
60 60
 			$setting['default'] = '';
61 61
 		});
62 62
 		return $settings;
Please login to merge, or discard this patch.
plugin/Modules/Rating.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	{
50 50
 		$average = array_sum( $ratingCounts );
51 51
 		if( $average > 0 ) {
52
-			$average = round( $this->getTotalSum( $ratingCounts ) / $average, intval( $roundBy ));
52
+			$average = round( $this->getTotalSum( $ratingCounts ) / $average, intval( $roundBy ) );
53 53
 		}
54
-		return floatval( apply_filters( 'site-reviews/rating/average', $average, $ratingCounts ));
54
+		return floatval( apply_filters( 'site-reviews/rating/average', $average, $ratingCounts ) );
55 55
 	}
56 56
 
57 57
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		}
73 73
 		$z = static::CONFIDENCE_LEVEL_Z_SCORES[$confidencePercentage];
74 74
 		$phat = 1 * $upDownCounts[1] / $numRatings;
75
-		return ( $phat + $z * $z / ( 2 * $numRatings ) - $z * sqrt(( $phat * ( 1 - $phat ) + $z * $z / ( 4 * $numRatings )) / $numRatings )) / ( 1 + $z * $z / $numRatings );
75
+		return ($phat + $z * $z / (2 * $numRatings) - $z * sqrt( ($phat * (1 - $phat) + $z * $z / (4 * $numRatings)) / $numRatings )) / (1 + $z * $z / $numRatings);
76 76
 	}
77 77
 
78 78
 	/**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	{
91 91
 		$total = array_sum( $ratingCounts );
92 92
 		foreach( $ratingCounts as $index => $count ) {
93
-			if( empty( $count ))continue;
93
+			if( empty($count) )continue;
94 94
 			$ratingCounts[$index] = $count / $total * 100;
95 95
 		}
96 96
 		return $this->getRoundedPercentages( $ratingCounts );
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			$this->getRankingUsingImdb( $ratingCounts ),
106 106
 			$ratingCounts,
107 107
 			$this
108
-		));
108
+		) );
109 109
 	}
110 110
 
111 111
 	/**
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
 		$avgRating = $this->getAverage( $ratingCounts );
124 124
 		// Represents a prior (your prior opinion without data) for the average star rating. A higher prior also means a higher margin for error.
125 125
 		// This could also be the average score of all items instead of a fixed value.
126
-		$bayesMean = ( $confidencePercentage / 100 ) * static::MAX_RATING; // prior, 70% = 3.5
126
+		$bayesMean = ($confidencePercentage / 100) * static::MAX_RATING; // prior, 70% = 3.5
127 127
 		// Represents the number of ratings expected to begin observing a pattern that would put confidence in the prior.
128 128
 		$bayesMinimal = 10; // confidence
129 129
 		$numOfReviews = array_sum( $ratingCounts );
130 130
 		return $avgRating > 0
131
-			? (( $bayesMinimal * $bayesMean ) + ( $avgRating * $numOfReviews )) / ( $bayesMinimal + $numOfReviews )
131
+			? (($bayesMinimal * $bayesMean) + ($avgRating * $numOfReviews)) / ($bayesMinimal + $numOfReviews)
132 132
 			: 0;
133 133
 	}
134 134
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		$weight = $this->getWeight( $ratingCounts, $ratingCountsSum );
149 149
 		$weightPow2 = $this->getWeight( $ratingCounts, $ratingCountsSum, true );
150 150
 		$zScore = static::CONFIDENCE_LEVEL_Z_SCORES[$confidencePercentage];
151
-		return $weight - $zScore * sqrt(( $weightPow2 - pow( $weight, 2 )) / ( $ratingCountsSum + 1 ));
151
+		return $weight - $zScore * sqrt( ($weightPow2 - pow( $weight, 2 )) / ($ratingCountsSum + 1) );
152 152
 	}
153 153
 
154 154
 	/**
@@ -168,14 +168,14 @@  discard block
 block discarded – undo
168 168
 		$remainders = glsr_array_column( $percentages, 'remainder' );
169 169
 		array_multisort( $remainders, SORT_DESC, SORT_STRING, $indexes, SORT_DESC, $percentages );
170 170
 		$i = 0;
171
-		if( array_sum( glsr_array_column( $percentages, 'percent' )) > 0 ) {
172
-			while( array_sum( glsr_array_column( $percentages, 'percent' )) < $totalPercent ) {
171
+		if( array_sum( glsr_array_column( $percentages, 'percent' ) ) > 0 ) {
172
+			while( array_sum( glsr_array_column( $percentages, 'percent' ) ) < $totalPercent ) {
173 173
 				$percentages[$i]['percent']++;
174 174
 				$i++;
175 175
 			}
176 176
 		}
177 177
 		array_multisort( $indexes, SORT_DESC, $percentages );
178
-		return array_combine( $indexes, glsr_array_column( $percentages, 'percent' ));
178
+		return array_combine( $indexes, glsr_array_column( $percentages, 'percent' ) );
179 179
 	}
180 180
 
181 181
 	/**
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	protected function getTotalSum( array $ratingCounts )
185 185
 	{
186
-		return array_reduce( array_keys( $ratingCounts ), function( $carry, $index ) use( $ratingCounts ) {
187
-			return $carry + ( $index * $ratingCounts[$index] );
186
+		return array_reduce( array_keys( $ratingCounts ), function( $carry, $index ) use($ratingCounts) {
187
+			return $carry + ($index * $ratingCounts[$index]);
188 188
 		});
189 189
 	}
190 190
 
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 	protected function getWeight( array $ratingCounts, $ratingCountsSum, $powerOf2 = false )
197 197
 	{
198 198
 		return array_reduce( array_keys( $ratingCounts ),
199
-			function( $count, $rating ) use( $ratingCounts, $ratingCountsSum, $powerOf2 ) {
199
+			function( $count, $rating ) use($ratingCounts, $ratingCountsSum, $powerOf2) {
200 200
 				$ratingLevel = $powerOf2
201 201
 					? pow( $rating, 2 )
202 202
 					: $rating;
203
-				return $count + ( $ratingLevel * ( $ratingCounts[$rating] + 1 )) / $ratingCountsSum;
203
+				return $count + ($ratingLevel * ($ratingCounts[$rating] + 1)) / $ratingCountsSum;
204 204
 			}
205 205
 		);
206 206
 	}
Please login to merge, or discard this patch.