Passed
Push — master ( 336c10...5d2e19 )
by Paul
02:17
created
src/Settings.php 1 patch
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@  discard block
 block discarded – undo
28 28
 	public function init()
29 29
 	{
30 30
 		// @todo: run GateKeeper here instead to check dependencies and capability
31
-		if( !is_plugin_active( 'meta-box/meta-box.php' ))return;
31
+		if( !is_plugin_active( 'meta-box/meta-box.php' )) {
32
+			return;
33
+		}
32 34
 
33 35
 		$this->normalize();
34 36
 
@@ -105,7 +107,9 @@  discard block
 block discarded – undo
105 107
 	 */
106 108
 	public function register( $metaboxes = [] )
107 109
 	{
108
-		if( get_current_screen()->id != $this->hook )return;
110
+		if( get_current_screen()->id != $this->hook ) {
111
+			return;
112
+		}
109 113
 		foreach( parent::register() as $metabox ) {
110 114
 			new SettingsMetaBox( $metabox );
111 115
 		}
@@ -172,7 +176,9 @@  discard block
 block discarded – undo
172 176
 	{
173 177
 		if( filter_input( INPUT_GET, 'page' ) !== static::ID
174 178
 			|| filter_input( INPUT_GET, 'action' ) !== 'reset'
175
-		)return;
179
+		) {
180
+			return;
181
+		}
176 182
 		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) {
177 183
 			update_option( static::ID, $this->getDefaults() );
178 184
 			return add_settings_error( static::ID, 'reset', __( 'Settings reset to defaults.', 'pollux' ), 'updated' );
@@ -186,7 +192,8 @@  discard block
 block discarded – undo
186 192
 	 */
187 193
 	protected function filterArrayByKey( array $array, $key )
188 194
 	{
189
-		return array_filter( $array, function( $value ) use( $key ) {
195
+		return array_filter( $array, function( $value ) use( $key )
196
+		{
190 197
 			return !empty( $value[$key] );
191 198
 		});
192 199
 	}
@@ -198,8 +205,10 @@  discard block
 block discarded – undo
198 205
 	{
199 206
 		$metaboxes = $this->filterArrayByKey( $this->metaboxes, 'slug' );
200 207
 
201
-		array_walk( $metaboxes, function( &$metabox ) {
202
-			$fields = array_map( function( $field ) {
208
+		array_walk( $metaboxes, function( &$metabox )
209
+		{
210
+			$fields = array_map( function( $field )
211
+			{
203 212
 				$field = wp_parse_args( $field, ['std' => ''] );
204 213
 				return [$field['slug'] => $field['std']];
205 214
 			}, $this->filterArrayByKey( $metabox['fields'], 'slug' ));
Please login to merge, or discard this patch.