Passed
Push — develop ( 8a82ca...c2270f )
by Paul
08:57 queued 04:20
created
src/Component.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 		$data = wp_parse_args( $data, $defaults );
40 40
 		foreach( $defaults as $key => $value ) {
41 41
 			$method = Helper::buildMethodName( $key, 'normalize' );
42
-			if( method_exists( $this, $method )) {
42
+			if( method_exists( $this, $method ) ) {
43 43
 				$data[$key] = $this->$method( $data[$key], $data, $id );
44 44
 			}
45 45
 		}
Please login to merge, or discard this patch.
src/MetaBox/Condition.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	protected function isAbsoluteConditionValid( $method, array $values )
69 69
 	{
70 70
 		foreach( $values as $value ) {
71
-			if( $this->$method( $value ))continue;
71
+			if( $this->$method( $value ) )continue;
72 72
 			return false;
73 73
 		}
74 74
 		return true;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	protected function isConditionValid( $key, $values )
83 83
 	{
84 84
 		$method = Helper::buildMethodName( $key, 'validate' );
85
-		if( !method_exists( $this, $method )) {
85
+		if( !method_exists( $this, $method ) ) {
86 86
 			return $this->validateUnknown( $key, $values );
87 87
 		}
88 88
 		$values = Helper::toArray( $values );
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	protected function isLooseConditionValid( $method, array $values )
99 99
 	{
100 100
 		foreach( $values as $value ) {
101
-			if( !$this->$method( $value ))continue;
101
+			if( !$this->$method( $value ) )continue;
102 102
 			return true;
103 103
 		}
104 104
 		return false;
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	protected function normalizeCondition( $conditions )
112 112
 	{
113
-		if( !is_array( $conditions )) {
113
+		if( !is_array( $conditions ) ) {
114 114
 			$conditions = [];
115 115
 		}
116
-		if( count( array_filter( array_keys( $conditions ), 'is_string' )) == 0 ) {
116
+		if( count( array_filter( array_keys( $conditions ), 'is_string' ) ) == 0 ) {
117 117
 			foreach( $conditions as $key ) {
118 118
 				$conditions[str_replace( '!', '', $key )] = substr( $key, 0, 1 ) == '!' ? 0 : 1;
119 119
 			}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		}
124 124
 		return array_intersect_key(
125 125
 			$conditions,
126
-			array_flip( $this->filter( 'conditions', static::conditions() ))
126
+			array_flip( $this->filter( 'conditions', static::conditions() ) )
127 127
 		);
128 128
 	}
129 129
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	protected function validateIsFrontPage( $value )
171 171
 	{
172
-		return $value == ( $this->getPostId() == get_option( 'page_on_front' ));
172
+		return $value == ($this->getPostId() == get_option( 'page_on_front' ));
173 173
 	}
174 174
 
175 175
 	/**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	protected function validateIsHome( $value )
180 180
 	{
181
-		return $value == ( $this->getPostId() == get_option( 'page_for_posts' ));
181
+		return $value == ($this->getPostId() == get_option( 'page_for_posts' ));
182 182
 	}
183 183
 
184 184
 	/**
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	protected function validateIsPageTemplate( $value )
189 189
 	{
190
-		return Helper::endsWith( $value, basename( get_page_template_slug( $this->getPostId() )));
190
+		return Helper::endsWith( $value, basename( get_page_template_slug( $this->getPostId() ) ) );
191 191
 	}
192 192
 
193 193
 	/**
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,9 @@  discard block
 block discarded – undo
68 68
 	protected function isAbsoluteConditionValid( $method, array $values )
69 69
 	{
70 70
 		foreach( $values as $value ) {
71
-			if( $this->$method( $value ))continue;
71
+			if( $this->$method( $value )) {
72
+				continue;
73
+			}
72 74
 			return false;
73 75
 		}
74 76
 		return true;
@@ -98,7 +100,9 @@  discard block
 block discarded – undo
98 100
 	protected function isLooseConditionValid( $method, array $values )
99 101
 	{
100 102
 		foreach( $values as $value ) {
101
-			if( !$this->$method( $value ))continue;
103
+			if( !$this->$method( $value )) {
104
+				continue;
105
+			}
102 106
 			return true;
103 107
 		}
104 108
 		return false;
Please login to merge, or discard this patch.
src/Settings/Settings.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	public static function id()
32 32
 	{
33
-		return apply_filters( sprintf( 'pollux/%s/id', static::ID ), Application::prefix() . static::ID );
33
+		return apply_filters( sprintf( 'pollux/%s/id', static::ID ), Application::prefix().static::ID );
34 34
 	}
35 35
 
36 36
 	/**
@@ -42,20 +42,20 @@  discard block
 block discarded – undo
42 42
 
43 43
 		$this->normalize( $this->app->config->{static::ID} );
44 44
 
45
-		add_action( 'pollux/'.static::ID.'/init',                [$this, 'addSubmitMetaBox'] );
46
-		add_action( 'current_screen',                            [$this, 'register'] );
47
-		add_action( 'admin_menu',                                [$this, 'registerPage'] );
48
-		add_action( 'admin_menu',                                [$this, 'registerSetting'] );
49
-		add_action( 'pollux/'.static::ID.'/init',                [$this, 'resetPage'] );
50
-		add_action( 'admin_print_footer_scripts',                [$this, 'renderFooterScript'] );
51
-		add_filter( 'pollux/'.static::ID.'/instruction',         [$this, 'filterInstruction'], 10, 3 );
45
+		add_action( 'pollux/'.static::ID.'/init', [$this, 'addSubmitMetaBox'] );
46
+		add_action( 'current_screen', [$this, 'register'] );
47
+		add_action( 'admin_menu', [$this, 'registerPage'] );
48
+		add_action( 'admin_menu', [$this, 'registerSetting'] );
49
+		add_action( 'pollux/'.static::ID.'/init', [$this, 'resetPage'] );
50
+		add_action( 'admin_print_footer_scripts', [$this, 'renderFooterScript'] );
51
+		add_filter( 'pollux/'.static::ID.'/instruction', [$this, 'filterInstruction'], 10, 3 );
52 52
 		add_filter( 'pollux/'.static::ID.'/before/instructions', [$this, 'filterBeforeInstructions'] );
53 53
 	}
54 54
 
55 55
 	public function canProceed()
56 56
 	{
57 57
 		return $this->app->gatekeeper->hasDependency( static::DEPENDENCY )
58
-			&& !empty( $this->app->config->{static::ID} );
58
+			&& !empty($this->app->config->{static::ID} );
59 59
 	}
60 60
 
61 61
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			$this->hook,
72 72
 			'side',
73 73
 			'high',
74
-		]));
74
+		] ) );
75 75
 	}
76 76
 
77 77
 	/**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		return $this->filter( 'save', array_merge(
105 105
 			array_intersect_key( $this->getSettings(), $settings ),
106 106
 			$settings
107
-		));
107
+		) );
108 108
 	}
109 109
 
110 110
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	public function register()
126 126
 	{
127 127
 		if( Helper::getCurrentScreen()->id != $this->hook )return;
128
-		if( $this->app->gatekeeper->hasDependency( self::DEPENDENCY )) {
128
+		if( $this->app->gatekeeper->hasDependency( self::DEPENDENCY ) ) {
129 129
 			foreach( parent::register() as $metabox ) {
130 130
 				new RWMetaBox( $metabox, static::ID, $this );
131 131
 			}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		add_screen_option( 'layout_columns', [
134 134
 			'max' => 2,
135 135
 			'default' => 2,
136
-		]);
136
+		] );
137 137
 		$this->action( 'init' );
138 138
 	}
139 139
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			[$this, 'renderPage'],
152 152
 			'dashicons-screenoptions',
153 153
 			1313
154
-		]));
154
+		] ) );
155 155
 	}
156 156
 
157 157
 	/**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 			'confirm' => __( 'Are you sure want to do this?', 'pollux' ),
175 175
 			'hook' => $this->hook,
176 176
 			'id' => static::id(),
177
-		]);
177
+		] );
178 178
 	}
179 179
 
180 180
 	/**
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 			'columns' => get_current_screen()->get_columns(),
188 188
 			'heading' => __( 'Site Settings', 'pollux' ),
189 189
 			'id' => static::id(),
190
-		]);
190
+		] );
191 191
 	}
192 192
 
193 193
 	/**
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 		];
205 205
 		$this->app->render( 'settings/submit', [
206 206
 			'reset' => __( 'Reset all', 'pollux' ),
207
-			'reset_url' => esc_url( add_query_arg( $query, admin_url( $pagenow ))),
207
+			'reset_url' => esc_url( add_query_arg( $query, admin_url( $pagenow ) ) ),
208 208
 			'submit' => get_submit_button( __( 'Save', 'pollux' ), 'primary', 'submit', false ),
209
-		]);
209
+		] );
210 210
 	}
211 211
 
212 212
 	/**
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 		if( filter_input( INPUT_GET, 'page' ) !== static::id()
219 219
 			|| filter_input( INPUT_GET, 'action' ) !== 'reset'
220 220
 		)return;
221
-		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) {
221
+		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook ) ) {
222 222
 			update_option( static::id(), $this->getDefaults() );
223 223
 			add_settings_error( static::id(), 'reset', __( 'Reset successful.', 'pollux' ), 'updated' );
224 224
 		}
225 225
 		else {
226
-			add_settings_error( static::id(), 'failed', __( 'Failed to reset. Please try again.', 'pollux' ));
226
+			add_settings_error( static::id(), 'failed', __( 'Failed to reset. Please try again.', 'pollux' ) );
227 227
 		}
228 228
 		set_transient( 'settings_errors', get_settings_errors(), 30 );
229
-		wp_safe_redirect( add_query_arg( 'settings-updated', 'true',  wp_get_referer() ));
229
+		wp_safe_redirect( add_query_arg( 'settings-updated', 'true', wp_get_referer() ) );
230 230
 		exit;
231 231
 	}
232 232
 
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	protected function filterArrayByKey( array $array, $key )
238 238
 	{
239
-		return array_filter( $array, function( $value ) use( $key ) {
240
-			return !empty( $value[$key] );
239
+		return array_filter( $array, function( $value ) use($key) {
240
+			return !empty($value[$key]);
241 241
 		});
242 242
 	}
243 243
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			$fields = array_map( function( $field ) {
253 253
 				$field = wp_parse_args( $field, ['std' => ''] );
254 254
 				return [$field['slug'] => $field['std']];
255
-			}, $this->filterArrayByKey( $metabox['fields'], 'slug' ));
255
+			}, $this->filterArrayByKey( $metabox['fields'], 'slug' ) );
256 256
 			$metabox = [
257 257
 				$metabox['slug'] => call_user_func_array( 'array_merge', $fields ),
258 258
 			];
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
 	protected function getSettings()
264 264
 	{
265
-		return (array) SiteMeta::all();
265
+		return (array)SiteMeta::all();
266 266
 	}
267 267
 
268 268
 	/**
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,9 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public function init()
40 40
 	{
41
-		if( !$this->canProceed() )return;
41
+		if( !$this->canProceed() ) {
42
+			return;
43
+		}
42 44
 
43 45
 		$this->normalize( $this->app->config->{static::ID} );
44 46
 
@@ -124,7 +126,9 @@  discard block
 block discarded – undo
124 126
 	 */
125 127
 	public function register()
126 128
 	{
127
-		if( Helper::getCurrentScreen()->id != $this->hook )return;
129
+		if( Helper::getCurrentScreen()->id != $this->hook ) {
130
+			return;
131
+		}
128 132
 		if( $this->app->gatekeeper->hasDependency( self::DEPENDENCY )) {
129 133
 			foreach( parent::register() as $metabox ) {
130 134
 				new RWMetaBox( $metabox, static::ID, $this );
@@ -169,7 +173,9 @@  discard block
 block discarded – undo
169 173
 	 */
170 174
 	public function renderFooterScript()
171 175
 	{
172
-		if( Helper::getCurrentScreen()->id != $this->hook )return;
176
+		if( Helper::getCurrentScreen()->id != $this->hook ) {
177
+			return;
178
+		}
173 179
 		$this->app->render( 'settings/script', [
174 180
 			'confirm' => __( 'Are you sure want to do this?', 'pollux' ),
175 181
 			'hook' => $this->hook,
@@ -217,7 +223,9 @@  discard block
 block discarded – undo
217 223
 	{
218 224
 		if( filter_input( INPUT_GET, 'page' ) !== static::id()
219 225
 			|| filter_input( INPUT_GET, 'action' ) !== 'reset'
220
-		)return;
226
+		) {
227
+			return;
228
+		}
221 229
 		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) {
222 230
 			update_option( static::id(), $this->getDefaults() );
223 231
 			add_settings_error( static::id(), 'reset', __( 'Reset successful.', 'pollux' ), 'updated' );
Please login to merge, or discard this patch.
src/Helper.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@  discard block
 block discarded – undo
11 11
 	 */
12 12
 	public static function buildClassName( $name, $path = '' )
13 13
 	{
14
-		$className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name )));
14
+		$className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name ) ) );
15 15
 		$className = implode( '', $className );
16
-		return !empty( $path )
17
-			? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className ))
16
+		return !empty($path)
17
+			? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className ) )
18 18
 			: $className;
19 19
 	}
20 20
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public static function buildMethodName( $name, $prefix = 'get' )
27 27
 	{
28
-		return lcfirst( static::buildClassName( $prefix . '-' . $name ));
28
+		return lcfirst( static::buildClassName( $prefix.'-'.$name ) );
29 29
 	}
30 30
 
31 31
 	/**
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 	public static function getCurrentScreen()
62 62
 	{
63 63
 		global $hook_suffix, $pagenow;
64
-		if( function_exists( 'get_current_screen' )) {
64
+		if( function_exists( 'get_current_screen' ) ) {
65 65
 			$screen = get_current_screen();
66 66
 		}
67
-		if( empty( $screen )) {
67
+		if( empty($screen) ) {
68 68
 			$screen = new \stdClass();
69 69
 			$screen->base = $screen->id = $hook_suffix;
70 70
 		}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public static function startsWith( $needle, $haystack )
81 81
 	{
82
-		return substr( $haystack, 0, strlen( $needle )) === $needle;
82
+		return substr( $haystack, 0, strlen( $needle ) ) === $needle;
83 83
 	}
84 84
 
85 85
 	/**
@@ -88,6 +88,6 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public static function toArray( $value )
90 90
 	{
91
-		return array_filter( (array) $value );
91
+		return array_filter( (array)$value );
92 92
 	}
93 93
 }
Please login to merge, or discard this patch.
src/Taxonomy/Taxonomy.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function init()
37 37
 	{
38
-		if( empty( $this->app->config->taxonomies ))return;
38
+		if( empty($this->app->config->taxonomies) )return;
39 39
 
40 40
 		$this->normalize();
41 41
 
42
-		add_action( 'restrict_manage_posts', [ $this, 'printFilters'] );
43
-		add_action( 'init',                  [ $this, 'register'] );
44
-		add_filter( 'parse_query',           [ $this, 'filterByTaxonomy'] );
42
+		add_action( 'restrict_manage_posts', [$this, 'printFilters'] );
43
+		add_action( 'init', [$this, 'register'] );
44
+		add_filter( 'parse_query', [$this, 'filterByTaxonomy'] );
45 45
 	}
46 46
 
47 47
 	/**
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 		if( !is_admin() || Helper::getCurrentScreen()->base != 'edit' )return;
54 54
 		$vars = &$query->query_vars;
55 55
 		foreach( array_keys( $this->taxonomies ) as $taxonomy ) {
56
-			if( !isset( $vars[$taxonomy] ))return;
57
-			if( $term = get_term_by( 'id', $vars[$taxonomy], $taxonomy )) {
56
+			if( !isset($vars[$taxonomy]) )return;
57
+			if( $term = get_term_by( 'id', $vars[$taxonomy], $taxonomy ) ) {
58 58
 				$vars[$taxonomy] = $term->slug;
59 59
 			}
60 60
 		}
@@ -69,18 +69,18 @@  discard block
 block discarded – undo
69 69
 	{
70 70
 		global $wp_query;
71 71
 		foreach( $this->taxonomies as $taxonomy => $args ) {
72
-			if( !in_array( get_current_screen()->post_type, $args['post_types'] ))continue;
73
-			$selected = isset( $wp_query->query[$taxonomy] )
72
+			if( !in_array( get_current_screen()->post_type, $args['post_types'] ) )continue;
73
+			$selected = isset($wp_query->query[$taxonomy])
74 74
 				? $wp_query->query[$taxonomy]
75 75
 				: false;
76
-			wp_dropdown_categories([
76
+			wp_dropdown_categories( [
77 77
 				'hide_if_empty' => true,
78 78
 				'name' => $taxonomy,
79 79
 				'orderby' => 'name',
80 80
 				'selected' => $selected,
81 81
 				'show_option_all' => $args['labels']['all_items'],
82 82
 				'taxonomy' => $taxonomy,
83
-			]);
83
+			] );
84 84
 		}
85 85
 	}
86 86
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	public function register()
92 92
 	{
93 93
 		array_walk( $this->taxonomies, function( $args, $taxonomy ) {
94
-			register_taxonomy( $taxonomy, $args['post_types'], array_diff_key( $args, array_flip( static::CUSTOM_KEYS )));
94
+			register_taxonomy( $taxonomy, $args['post_types'], array_diff_key( $args, array_flip( static::CUSTOM_KEYS ) ) );
95 95
 			foreach( $args['post_types'] as $type ) {
96 96
 				register_taxonomy_for_object_type( $taxonomy, $type );
97 97
 			}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function normalizeLabels( $labels, array $args )
122 122
 	{
123
-		return wp_parse_args( $labels, $this->setLabels( $args ));
123
+		return wp_parse_args( $labels, $this->setLabels( $args ) );
124 124
 	}
125 125
 
126 126
 	/**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	protected function normalizeMenuName( $menuname, array $args )
131 131
 	{
132
-		return empty( $menuname )
132
+		return empty($menuname)
133 133
 			? $args['plural']
134 134
 			: $menuname;
135 135
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function init()
37 37
 	{
38
-		if( empty( $this->app->config->taxonomies ))return;
38
+		if( empty( $this->app->config->taxonomies )) {
39
+			return;
40
+		}
39 41
 
40 42
 		$this->normalize();
41 43
 
@@ -50,10 +52,14 @@  discard block
 block discarded – undo
50 52
 	 */
51 53
 	public function filterByTaxonomy( WP_Query $query )
52 54
 	{
53
-		if( !is_admin() || Helper::getCurrentScreen()->base != 'edit' )return;
55
+		if( !is_admin() || Helper::getCurrentScreen()->base != 'edit' ) {
56
+			return;
57
+		}
54 58
 		$vars = &$query->query_vars;
55 59
 		foreach( array_keys( $this->taxonomies ) as $taxonomy ) {
56
-			if( !isset( $vars[$taxonomy] ))return;
60
+			if( !isset( $vars[$taxonomy] )) {
61
+				return;
62
+			}
57 63
 			if( $term = get_term_by( 'id', $vars[$taxonomy], $taxonomy )) {
58 64
 				$vars[$taxonomy] = $term->slug;
59 65
 			}
@@ -69,7 +75,9 @@  discard block
 block discarded – undo
69 75
 	{
70 76
 		global $wp_query;
71 77
 		foreach( $this->taxonomies as $taxonomy => $args ) {
72
-			if( !in_array( get_current_screen()->post_type, $args['post_types'] ))continue;
78
+			if( !in_array( get_current_screen()->post_type, $args['post_types'] )) {
79
+				continue;
80
+			}
73 81
 			$selected = isset( $wp_query->query[$taxonomy] )
74 82
 				? $wp_query->query[$taxonomy]
75 83
 				: false;
Please login to merge, or discard this patch.
src/MetaBox/MetaBox.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function init()
34 34
 	{
35
-		if( empty( $this->app->config->{static::ID} ))return;
35
+		if( empty($this->app->config->{static::ID} ) )return;
36 36
 		$this->normalize( $this->app->config->{static::ID}, [
37 37
 			'post_types' => [],
38
-		]);
38
+		] );
39 39
 		add_filter( 'rwmb_normalize_map_field', [$this, 'normalizeMapField'] );
40
-		add_filter( 'rwmb_show',                [$this, 'show'], 10, 2 );
41
-		add_filter( 'rwmb_meta_boxes',          [$this, 'register'] );
42
-		add_filter( 'rwmb_outer_html',          [$this, 'renderField'], 10, 2 );
40
+		add_filter( 'rwmb_show', [$this, 'show'], 10, 2 );
41
+		add_filter( 'rwmb_meta_boxes', [$this, 'register'] );
42
+		add_filter( 'rwmb_outer_html', [$this, 'renderField'], 10, 2 );
43 43
 	}
44 44
 
45 45
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	{
73 73
 		return PostMeta::get( $key, [
74 74
 			'id' => $this->getPostId(),
75
-		]);
75
+		] );
76 76
 	}
77 77
 
78 78
 	/**
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function normalizeMapField( $field )
83 83
 	{
84
-		if( empty( $field['address_field'] )) {
84
+		if( empty($field['address_field']) ) {
85 85
 			return $field;
86 86
 		}
87
-		if( !Helper::startsWith( Application::PREFIX, $field['address_field'] )) {
88
-			$field['address_field'] = Application::PREFIX . $field['address_field'];
87
+		if( !Helper::startsWith( Application::PREFIX, $field['address_field'] ) ) {
88
+			$field['address_field'] = Application::PREFIX.$field['address_field'];
89 89
 		}
90 90
 		$apiKey = SiteMeta::services( $field['api_key'] );
91
-		if( !empty( $apiKey ) && is_string( $apiKey )) {
91
+		if( !empty($apiKey) && is_string( $apiKey ) ) {
92 92
 			$field['api_key'] = $apiKey;
93 93
 		}
94 94
 		return $field;
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function register()
102 102
 	{
103
-		if( current_user_can( 'switch_themes' )) {
103
+		if( current_user_can( 'switch_themes' ) ) {
104 104
 			$instructions = $this->initInstructions();
105
-			if( is_array( $instructions )) {
105
+			if( is_array( $instructions ) ) {
106 106
 				$this->normalize( $instructions );
107 107
 			}
108 108
 		}
109 109
 		$metaboxes = func_num_args()
110
-			? Helper::toArray( func_get_arg(0) )
110
+			? Helper::toArray( func_get_arg( 0 ) )
111 111
 			: [];
112 112
 		return array_merge( $metaboxes, $this->metaboxes );
113 113
 	}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	public function renderField( $html, $field )
120 120
 	{
121
-		return !isset( $field['condition'] ) || $this->validate( $field['condition'] )
121
+		return !isset($field['condition']) || $this->validate( $field['condition'] )
122 122
 			? $html
123 123
 			: '';
124 124
 	}
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 	public function show( $bool, array $metabox )
131 131
 	{
132 132
 		if( defined( 'DOING_AJAX' )
133
-			|| !isset( $metabox['condition'] )
134
-			|| !$this->hasPostType( $metabox )) {
133
+			|| !isset($metabox['condition'])
134
+			|| !$this->hasPostType( $metabox ) ) {
135 135
 			return $bool;
136 136
 		}
137 137
 		return $this->validate( $metabox['condition'] );
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	protected function getPostId()
144 144
 	{
145
-		if( !( $postId = filter_input( INPUT_GET, 'post' ))) {
145
+		if( !($postId = filter_input( INPUT_GET, 'post' )) ) {
146 146
 			$postId = filter_input( INPUT_POST, 'post_ID' );
147 147
 		}
148 148
 		return intval( $postId );
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 	{
156 156
 		return array_unique( iterator_to_array(
157 157
 			new RecursiveIteratorIterator(
158
-				new RecursiveArrayIterator( array_column( $this->metaboxes, 'post_types' ))
158
+				new RecursiveArrayIterator( array_column( $this->metaboxes, 'post_types' ) )
159 159
 			),
160 160
 			false
161
-		));
161
+		) );
162 162
 	}
163 163
 
164 164
 	/**
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	protected function hasPostType( array $metabox )
168 168
 	{
169
-		if( !isset( $metabox['post_types'] )) {
169
+		if( !isset($metabox['post_types']) ) {
170 170
 			return true;
171 171
 		}
172
-		if( !( $type = filter_input( INPUT_GET, 'post_type' ))) {
172
+		if( !($type = filter_input( INPUT_GET, 'post_type' )) ) {
173 173
 			$type = get_post_type( $this->getPostId() );
174 174
 		}
175 175
 		return in_array( $type, $metabox['post_types'] );
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				'id' => $id,
188 188
 				'slug' => $id,
189 189
 				'validation' => [],
190
-			]);
190
+			] );
191 191
 			$this->metaboxes[] = $this->setDependencies(
192 192
 				$this->normalizeThis( $metabox, $data, $id )
193 193
 			);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 */
202 202
 	protected function normalizeDepends( $depends, array $data, $parentId )
203 203
 	{
204
-		return is_string( $depends ) && !empty( $depends )
204
+		return is_string( $depends ) && !empty($depends)
205 205
 			? $this->normalizeId( $depends, $data, $parentId )
206 206
 			: '';
207 207
 	}
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 */
222 222
 	protected function normalizeFields( array $fields, array $data, $parentId )
223 223
 	{
224
-		return array_map( function( $id, $field ) use( $parentId ) {
225
-			$defaults =  [
224
+		return array_map( function( $id, $field ) use($parentId) {
225
+			$defaults = [
226 226
 				'attributes' => [],
227 227
 				'class' => '',
228 228
 				'condition' => [],
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	protected function normalizeId( $id, array $data, $parentId )
244 244
 	{
245
-		return Application::prefix() . $id;
245
+		return Application::prefix().$id;
246 246
 	}
247 247
 
248 248
 	/**
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
 	protected function normalizeValidation( array $validation, array $data, $parentId )
261 261
 	{
262 262
 		foreach( ['messages', 'rules'] as $key ) {
263
-			if( empty( $validation[$key] ))continue;
263
+			if( empty($validation[$key]) )continue;
264 264
 			foreach( $validation[$key] as $id => $value ) {
265 265
 				$validation[$key][$this->normalizeFieldName( $id, ['slug' => $id], $parentId )] = $value;
266
-				unset( $validation[$key][$id] );
266
+				unset($validation[$key][$id]);
267 267
 			}
268 268
 		}
269 269
 		return $validation;
@@ -276,17 +276,17 @@  discard block
 block discarded – undo
276 276
 	{
277 277
 		$fields = &$metabox['fields'];
278 278
 		$depends = array_column( $fields, 'depends' );
279
-		array_walk( $depends, function( $value, $index ) use( &$fields, $metabox ) {
280
-			if( empty( $value ))return;
279
+		array_walk( $depends, function( $value, $index ) use(&$fields, $metabox) {
280
+			if( empty($value) )return;
281 281
 			$fields[$index]['attributes']['data-depends'] = $value;
282
-			list( $key, $value ) = array_pad( explode( '|', $value ), 2, null );
283
-			$dependency = array_search( $key, array_column( $fields, 'id' ));
282
+			list($key, $value) = array_pad( explode( '|', $value ), 2, null );
283
+			$dependency = array_search( $key, array_column( $fields, 'id' ) );
284 284
 			$metaValue = $this->getMetaValue( $fields[$dependency]['slug'], '', $metabox['slug'] );
285 285
 			$isHidden = $value === null
286 286
 				? $metaValue === ''
287 287
 				: $metaValue != $value;
288 288
 			if( $isHidden ) {
289
-				$fields[$index]['class'] = trim( 'hidden ' . $fields[$index]['class'] );
289
+				$fields[$index]['class'] = trim( 'hidden '.$fields[$index]['class'] );
290 290
 			}
291 291
 		});
292 292
 		return $metabox;
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function init()
34 34
 	{
35
-		if( empty( $this->app->config->{static::ID} ))return;
35
+		if( empty( $this->app->config->{static::ID} )) {
36
+			return;
37
+		}
36 38
 		$this->normalize( $this->app->config->{static::ID}, [
37 39
 			'post_types' => [],
38 40
 		]);
@@ -260,7 +262,9 @@  discard block
 block discarded – undo
260 262
 	protected function normalizeValidation( array $validation, array $data, $parentId )
261 263
 	{
262 264
 		foreach( ['messages', 'rules'] as $key ) {
263
-			if( empty( $validation[$key] ))continue;
265
+			if( empty( $validation[$key] )) {
266
+				continue;
267
+			}
264 268
 			foreach( $validation[$key] as $id => $value ) {
265 269
 				$validation[$key][$this->normalizeFieldName( $id, ['slug' => $id], $parentId )] = $value;
266 270
 				unset( $validation[$key][$id] );
@@ -277,7 +281,9 @@  discard block
 block discarded – undo
277 281
 		$fields = &$metabox['fields'];
278 282
 		$depends = array_column( $fields, 'depends' );
279 283
 		array_walk( $depends, function( $value, $index ) use( &$fields, $metabox ) {
280
-			if( empty( $value ))return;
284
+			if( empty( $value )) {
285
+				return;
286
+			}
281 287
 			$fields[$index]['attributes']['data-depends'] = $value;
282 288
 			list( $key, $value ) = array_pad( explode( '|', $value ), 2, null );
283 289
 			$dependency = array_search( $key, array_column( $fields, 'id' ));
Please login to merge, or discard this patch.
src/GateKeeper.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 	{
36 36
 		$this->notice = pollux_app()->make( 'Notice' );
37 37
 
38
-		add_action( 'current_screen',                         [$this, 'activatePlugin'] );
38
+		add_action( 'current_screen', [$this, 'activatePlugin'] );
39 39
 		add_action( 'wp_ajax_pollux/dependency/activate_url', [$this, 'ajaxActivatePluginLink'] );
40
-		add_action( 'admin_notices',                          [$this, 'printNotices'] );
41
-		add_action( 'current_screen',                         [$this, 'setDependencyNotice'] );
40
+		add_action( 'admin_notices', [$this, 'printNotices'] );
41
+		add_action( 'current_screen', [$this, 'setDependencyNotice'] );
42 42
 	}
43 43
 
44 44
 	/**
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 			|| filter_input( INPUT_GET, 'action' ) != 'activate'
51 51
 		)return;
52 52
 		$plugin = filter_input( INPUT_GET, 'plugin' );
53
-		check_admin_referer( 'activate-plugin_' . $plugin );
53
+		check_admin_referer( 'activate-plugin_'.$plugin );
54 54
 		$result = activate_plugin( $plugin, null, is_network_admin(), true );
55
-		if( is_wp_error( $result )) {
55
+		if( is_wp_error( $result ) ) {
56 56
 			wp_die( $result->get_error_message() );
57 57
 		}
58 58
 		wp_safe_redirect( wp_get_referer() );
@@ -66,19 +66,19 @@  discard block
 block discarded – undo
66 66
 	{
67 67
 		check_ajax_referer( 'updates' );
68 68
 		$plugin = filter_input( INPUT_POST, 'plugin' );
69
-		if( !$this->isPluginDependency( $plugin )) {
69
+		if( !$this->isPluginDependency( $plugin ) ) {
70 70
 			wp_send_json_error();
71 71
 		}
72
-		$activateUrl = add_query_arg([
73
-			'_wpnonce' => wp_create_nonce( sprintf( 'activate-plugin_%s', $plugin )),
72
+		$activateUrl = add_query_arg( [
73
+			'_wpnonce' => wp_create_nonce( sprintf( 'activate-plugin_%s', $plugin ) ),
74 74
 			'action' => 'activate',
75 75
 			'page' => pollux_app()->id,
76 76
 			'plugin' => $plugin,
77
-		], self_admin_url( 'options-general.php' ));
78
-		wp_send_json_success([
77
+		], self_admin_url( 'options-general.php' ) );
78
+		wp_send_json_success( [
79 79
 			'activate_url' => $activateUrl,
80 80
 			filter_input( INPUT_POST, 'type' ) => $plugin,
81
-		]);
81
+		] );
82 82
 	}
83 83
 
84 84
 	/**
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function hasDependency( $plugin )
88 88
 	{
89
-		if( !$this->isPluginDependency( $plugin )) {
89
+		if( !$this->isPluginDependency( $plugin ) ) {
90 90
 			return true;
91 91
 		}
92 92
 		return $this->isPluginInstalled( $plugin ) && $this->isPluginValid( $plugin );
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	public function hasPendingDependencies()
99 99
 	{
100 100
 		foreach( $this->dependencies as $plugin => $data ) {
101
-			if( !$this->isPluginDependency( $plugin ))continue;
101
+			if( !$this->isPluginDependency( $plugin ) )continue;
102 102
 			$this->isPluginActive( $plugin );
103 103
 			$this->isPluginVersionValid( $plugin );
104 104
 		}
105
-		return !empty( $this->errors );
105
+		return !empty($this->errors);
106 106
 	}
107 107
 
108 108
 	/**
@@ -146,17 +146,17 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function isPluginVersionValid( $plugin )
148 148
 	{
149
-		if( !$this->isPluginDependency( $plugin )) {
149
+		if( !$this->isPluginDependency( $plugin ) ) {
150 150
 			return true;
151 151
 		}
152
-		if( !$this->isPluginInstalled( $plugin )) {
152
+		if( !$this->isPluginInstalled( $plugin ) ) {
153 153
 			return false;
154 154
 		}
155 155
 		return $this->catchError( $plugin, 'wrong_version', version_compare(
156 156
 			$this->getPluginRequirements( $plugin, 'version' ),
157 157
 			$this->getAllPlugins()[$plugin]['Version'],
158 158
 			'<='
159
-		));
159
+		) );
160 160
 	}
161 161
 
162 162
 	/**
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	protected function catchError( $plugin, $error, $isValid )
195 195
 	{
196
-		if( !$isValid && $this->isPluginDependency( $plugin )) {
197
-			if( !isset( $this->errors[$plugin] )) {
196
+		if( !$isValid && $this->isPluginDependency( $plugin ) ) {
197
+			if( !isset($this->errors[$plugin]) ) {
198 198
 				$this->errors[$plugin] = [];
199 199
 			}
200 200
 			$this->errors[$plugin] = array_keys( array_flip(
201 201
 				array_merge( $this->errors[$plugin], [$error] )
202
-			));
202
+			) );
203 203
 		}
204 204
 		return $isValid;
205 205
 	}
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function getAllPlugins()
211 211
 	{
212
-		require_once ABSPATH . 'wp-admin/includes/plugin.php';
212
+		require_once ABSPATH.'wp-admin/includes/plugin.php';
213 213
 		return array_merge( get_plugins(), $this->getMustUsePlugins() );
214 214
 	}
215 215
 
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
 	{
221 221
 		$actions = '';
222 222
 		foreach( $this->errors as $plugin => $errors ) {
223
-			if( in_array( 'not_found', $errors ) && current_user_can( 'install_plugins' )) {
224
-				$actions .= $this->notice->installButton( $this->getPluginRequirements( $plugin ));
223
+			if( in_array( 'not_found', $errors ) && current_user_can( 'install_plugins' ) ) {
224
+				$actions .= $this->notice->installButton( $this->getPluginRequirements( $plugin ) );
225 225
 			}
226
-			else if( in_array( 'wrong_version', $errors ) && current_user_can( 'update_plugins' )) {
227
-				$actions .= $this->notice->updateButton( $this->getPluginInformation( $plugin ));
226
+			else if( in_array( 'wrong_version', $errors ) && current_user_can( 'update_plugins' ) ) {
227
+				$actions .= $this->notice->updateButton( $this->getPluginInformation( $plugin ) );
228 228
 			}
229
-			else if( in_array( 'inactive', $errors ) && current_user_can( 'activate_plugins' )) {
230
-				$actions .= $this->notice->activateButton( $this->getPluginInformation( $plugin ));
229
+			else if( in_array( 'inactive', $errors ) && current_user_can( 'activate_plugins' ) ) {
230
+				$actions .= $this->notice->activateButton( $this->getPluginInformation( $plugin ) );
231 231
 			}
232 232
 		}
233 233
 		return $actions;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	protected function getDependencyLinks()
240 240
 	{
241 241
 		return array_reduce( array_keys( $this->errors ), function( $carry, $plugin ) {
242
-			return $carry . $this->getPluginLink( $plugin );
242
+			return $carry.$this->getPluginLink( $plugin );
243 243
 		});
244 244
 	}
245 245
 
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 	protected function getMustUsePlugins()
250 250
 	{
251 251
 		$plugins = get_mu_plugins();
252
-		if( in_array( 'Bedrock Autoloader', array_column( $plugins, 'Name' ))) {
252
+		if( in_array( 'Bedrock Autoloader', array_column( $plugins, 'Name' ) ) ) {
253 253
 			$autoloadedPlugins = get_site_option( 'bedrock_autoloader' );
254
-			if( !empty( $autoloadedPlugins['plugins'] )) {
254
+			if( !empty($autoloadedPlugins['plugins']) ) {
255 255
 				return array_merge( $plugins, $autoloadedPlugins['plugins'] );
256 256
 			}
257 257
 		}
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 */
264 264
 	protected function getPlugin( $plugin )
265 265
 	{
266
-		if( $this->isPluginInstalled( $plugin )) {
266
+		if( $this->isPluginInstalled( $plugin ) ) {
267 267
 			return $this->getAllPlugins()[$plugin];
268 268
 		}
269 269
 		return false;
@@ -274,17 +274,17 @@  discard block
 block discarded – undo
274 274
 	 */
275 275
 	protected function getPluginData( $plugin, $data, $key = null )
276 276
 	{
277
-		if( !is_array( $data )) {
278
-			throw new Exception( sprintf( 'Plugin information not found for: %s', $plugin ));
277
+		if( !is_array( $data ) ) {
278
+			throw new Exception( sprintf( 'Plugin information not found for: %s', $plugin ) );
279 279
 		}
280 280
 		$data['plugin'] = $plugin;
281 281
 		$data['slug'] = $this->getPluginSlug( $plugin );
282 282
 		$data = array_change_key_case( $data );
283
-		if( is_null( $key )) {
283
+		if( is_null( $key ) ) {
284 284
 			return $data;
285 285
 		}
286 286
 		$key = strtolower( $key );
287
-		return isset( $data[$key] )
287
+		return isset($data[$key])
288 288
 			? $data[$key]
289 289
 			: '';
290 290
 	}
@@ -332,6 +332,6 @@  discard block
 block discarded – undo
332 332
 	 */
333 333
 	protected function getPluginSlug( $plugin )
334 334
 	{
335
-		return substr( $plugin, 0, strrpos( $plugin, '/' ));
335
+		return substr( $plugin, 0, strrpos( $plugin, '/' ) );
336 336
 	}
337 337
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,9 @@  discard block
 block discarded – undo
48 48
 	{
49 49
 		if( get_current_screen()->id != sprintf( 'settings_page_%s', pollux_app()->id )
50 50
 			|| filter_input( INPUT_GET, 'action' ) != 'activate'
51
-		)return;
51
+		) {
52
+			return;
53
+		}
52 54
 		$plugin = filter_input( INPUT_GET, 'plugin' );
53 55
 		check_admin_referer( 'activate-plugin_' . $plugin );
54 56
 		$result = activate_plugin( $plugin, null, is_network_admin(), true );
@@ -98,7 +100,9 @@  discard block
 block discarded – undo
98 100
 	public function hasPendingDependencies()
99 101
 	{
100 102
 		foreach( $this->dependencies as $plugin => $data ) {
101
-			if( !$this->isPluginDependency( $plugin ))continue;
103
+			if( !$this->isPluginDependency( $plugin )) {
104
+				continue;
105
+			}
102 106
 			$this->isPluginActive( $plugin );
103 107
 			$this->isPluginVersionValid( $plugin );
104 108
 		}
@@ -177,7 +181,9 @@  discard block
 block discarded – undo
177 181
 		if( get_current_screen()->id != 'settings_page_pollux'
178 182
 			|| pollux_app()->config->disable_config
179 183
 			|| !$this->hasPendingDependencies()
180
-		)return;
184
+		) {
185
+			return;
186
+		}
181 187
 		$message = sprintf( '<strong>%s:</strong> %s',
182 188
 			__( 'Pollux requires the latest version of the following plugins', 'pollux' ),
183 189
 			$this->getDependencyLinks()
Please login to merge, or discard this patch.
src/Settings/RWMetaBox.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 		add_action( 'pollux/archives/init', [$this, 'add_meta_boxes'] );
26 26
 		add_action( 'pollux/settings/init', [$this, 'add_meta_boxes'] );
27
-		add_filter( 'rwmb_field_meta',      [$this, '_get_field_meta'], 10, 3 );
27
+		add_filter( 'rwmb_field_meta', [$this, '_get_field_meta'], 10, 3 );
28 28
 		add_filter( 'rwmb_normalize_field', [$this, '_normalize_field'] );
29 29
 	}
30 30
 
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public function _get_field_meta( $meta, array $field, $saved )
38 38
 	{
39
-		if( !$this->is_edit_screen() || !empty( Helper::toArray( $meta )) || empty( $field['slug'] )) {
39
+		if( !$this->is_edit_screen() || !empty(Helper::toArray( $meta )) || empty($field['slug']) ) {
40 40
 			return $meta;
41 41
 		}
42
-		$meta = call_user_func( [RWMB_Helpers_Field::get_class( $field ), 'esc_meta'], ( $saved
42
+		$meta = call_user_func( [RWMB_Helpers_Field::get_class( $field ), 'esc_meta'], ($saved
43 43
 			? $this->pollux_caller->getMetaValue( $field['slug'], $meta, $this->meta_box['slug'] )
44 44
 			: $field['std']
45
-		));
45
+		) );
46 46
 		return $this->_normalize_field_meta( $meta, $field );
47 47
 	}
48 48
 
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function _normalize_field( array $field )
53 53
 	{
54
-		if( !empty( $field['multiple'] ) && $field['id'] == substr( $field['field_name'], 0, -2 )) {
55
-			$parts = array_filter( explode( '-', $field['id'] ));
54
+		if( !empty($field['multiple']) && $field['id'] == substr( $field['field_name'], 0, -2 ) ) {
55
+			$parts = array_filter( explode( '-', $field['id'] ) );
56 56
 			$first = array_shift( $parts );
57 57
 			$field['field_name'] = array_reduce( $parts, function( $carry, $part ) {
58 58
 				return sprintf( '%s[%s]', $carry, $part );
59
-			}, $first ) . '[]';
59
+			}, $first ).'[]';
60 60
 		}
61 61
 		return $field;
62 62
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function _normalize_field_meta( $meta, array $field )
69 69
 	{
70
-		if( !empty( $meta ) && is_array( $meta )) {
70
+		if( !empty($meta) && is_array( $meta ) ) {
71 71
 			return $meta;
72 72
 		}
73 73
 		if( $field['clone'] ) {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	public function is_saved()
111 111
 	{
112 112
 		foreach( array_column( $this->fields, 'slug' ) as $field ) {
113
-			if( !is_null( $this->pollux_caller->getMetaValue( $field, null, $this->meta_box['slug'] ))) {
113
+			if( !is_null( $this->pollux_caller->getMetaValue( $field, null, $this->meta_box['slug'] ) ) ) {
114 114
 				return true;
115 115
 			}
116 116
 		}
Please login to merge, or discard this patch.
src/Container.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -16,18 +16,18 @@  discard block
 block discarded – undo
16 16
 	 */
17 17
 	protected static $instance;
18 18
 
19
-    /**
20
-     * The container's bound services.
21
-     *
22
-     * @var array
23
-     */
19
+	/**
20
+	 * The container's bound services.
21
+	 *
22
+	 * @var array
23
+	 */
24 24
 	protected $services = [];
25 25
 
26
-    /**
27
-     * The container's bucket items
28
-     *
29
-     * @var array
30
-     */
26
+	/**
27
+	 * The container's bucket items
28
+	 *
29
+	 * @var array
30
+	 */
31 31
 	protected $bucket = [];
32 32
 
33 33
 	/**
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 	}
124 124
 
125 125
    /**
126
-	 * Register a Provider.
127
-	 *
128
-	 * @return void
129
-	 */
126
+    * Register a Provider.
127
+    *
128
+    * @return void
129
+    */
130 130
 	public function register( $provider )
131 131
 	{
132 132
 		$provider->register( $this );
@@ -148,17 +148,17 @@  discard block
 block discarded – undo
148 148
 		return $abstract;
149 149
 	}
150 150
 
151
-    /**
152
-     * @param \ReflectionParameter $parameter
153
-     * @return null|\ReflectionClass|\ReflectionNamedType|\ReflectionType
154
-     */
155
-    protected function getClass($parameter)
156
-    {
157
-        if (version_compare(phpversion(), '8', '<')) {
158
-            return $parameter->getClass(); // @compat PHP < 8
159
-        }
160
-        return $parameter->getType();
161
-    }
151
+	/**
152
+	 * @param \ReflectionParameter $parameter
153
+	 * @return null|\ReflectionClass|\ReflectionNamedType|\ReflectionType
154
+	 */
155
+	protected function getClass($parameter)
156
+	{
157
+		if (version_compare(phpversion(), '8', '<')) {
158
+			return $parameter->getClass(); // @compat PHP < 8
159
+		}
160
+		return $parameter->getType();
161
+	}
162 162
 
163 163
 	/**
164 164
 	 * Throw an exception that the concrete is not instantiable.
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public static function getInstance()
39 39
 	{
40
-		if( is_null( static::$instance )) {
40
+		if( is_null( static::$instance ) ) {
41 41
 			static::$instance = new static;
42 42
 		}
43 43
 
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function make( $abstract )
70 70
 	{
71
-		$service = isset( $this->services[$abstract] )
71
+		$service = isset($this->services[$abstract])
72 72
 			? $this->services[$abstract]
73 73
 			: $this->addNamespace( $abstract );
74 74
 
75
-		if( is_callable( $service )) {
75
+		if( is_callable( $service ) ) {
76 76
 			return call_user_func_array( $service, [$this] );
77 77
 		}
78
-		if( is_object( $service )) {
78
+		if( is_object( $service ) ) {
79 79
 			return $service;
80 80
 		}
81 81
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function singleton( $abstract, $concrete )
94 94
 	{
95
-		$this->bind( $abstract, $this->make( $concrete ));
95
+		$this->bind( $abstract, $this->make( $concrete ) );
96 96
 	}
97 97
 
98 98
 	/**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function __get( $item )
106 106
 	{
107
-		return isset( $this->bucket[$item] )
107
+		return isset($this->bucket[$item])
108 108
 			? $this->bucket[$item]
109 109
 			: null;
110 110
 	}
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	protected function addNamespace( $abstract )
143 143
 	{
144
-		if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract )) {
145
-			$abstract = __NAMESPACE__ . "\\$abstract";
144
+		if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract ) ) {
145
+			$abstract = __NAMESPACE__."\\$abstract";
146 146
 		}
147 147
 
148 148
 		return $abstract;
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
      * @param \ReflectionParameter $parameter
153 153
      * @return null|\ReflectionClass|\ReflectionNamedType|\ReflectionType
154 154
      */
155
-    protected function getClass($parameter)
155
+    protected function getClass( $parameter )
156 156
     {
157
-        if (version_compare(phpversion(), '8', '<')) {
157
+        if( version_compare( phpversion(), '8', '<' ) ) {
158 158
             return $parameter->getClass(); // @compat PHP < 8
159 159
         }
160 160
         return $parameter->getType();
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 			return $this->notInstantiable( $concrete );
196 196
 		}
197 197
 
198
-		if( is_null(( $constructor = $reflector->getConstructor() ))) {
198
+		if( is_null( ($constructor = $reflector->getConstructor()) ) ) {
199 199
 			return new $concrete;
200 200
 		}
201 201
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	protected function resolveClass( ReflectionParameter $parameter )
214 214
 	{
215 215
 		try {
216
-			return $this->make( $this->getClass($parameter)->getName() );
216
+			return $this->make( $this->getClass( $parameter )->getName() );
217 217
 		}
218 218
 		catch( Exception $e ) {
219 219
 			if( $parameter->isOptional() ) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 
235 235
 		foreach( $dependencies as $dependency ) {
236 236
 			// If the class is null, the dependency is a string or some other primitive type
237
-			$results[] = !is_null( $class = $this->getClass($dependency) )
237
+			$results[] = !is_null( $class = $this->getClass( $dependency ) )
238 238
 				? $this->resolveClass( $dependency )
239 239
 				: null;
240 240
 		}
Please login to merge, or discard this patch.