Passed
Push — master ( 9d21ea...9827a3 )
by Paul
02:49
created
src/MetaBox.php 1 patch
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,7 +61,8 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function verifyMetaBoxCondition( array $conditions )
63 63
 	{
64
-		array_walk( $conditions, function( &$value, $key ) {
64
+		array_walk( $conditions, function( &$value, $key )
65
+		{
65 66
 			$method = $this->app->buildMethodName( $key, 'validate' );
66 67
 			$value = method_exists( $this, $method )
67 68
 				? $this->$method( $value )
@@ -75,9 +76,12 @@  discard block
 block discarded – undo
75 76
 	 */
76 77
 	protected function addInstructions()
77 78
 	{
78
-		if( !count( array_filter( $this->metaboxes, function( $metabox ) {
79
+		if( !count( array_filter( $this->metaboxes, function( $metabox )
80
+		{
79 81
 			return $this->isVisible( false, $metabox );
80
-		})))return;
82
+		}))) {
83
+			return;
84
+		}
81 85
 		$this->metaboxes[] = [
82 86
 			'id' => 'infodiv',
83 87
 			'post_types' => $this->getPostTypes(),
@@ -97,8 +101,10 @@  discard block
 block discarded – undo
97 101
 	 */
98 102
 	protected function generateInstructions()
99 103
 	{
100
-		return array_reduce( $this->getInstructions(), function( $html, $metabox ) {
101
-			$fields = array_reduce( array_column( $metabox['fields'], 'slug' ), function( $html, $slug ) use( $metabox ) {
104
+		return array_reduce( $this->getInstructions(), function( $html, $metabox )
105
+		{
106
+			$fields = array_reduce( array_column( $metabox['fields'], 'slug' ), function( $html, $slug ) use( $metabox )
107
+			{
102 108
 				$hook = sprintf( 'pollux/%s/instruction', $this->getClassname() );
103 109
 				return $html . apply_filters( $hook, "PostMeta::get('{$slug}');", $slug, $metabox['slug'] ) . PHP_EOL;
104 110
 			});
@@ -114,7 +120,8 @@  discard block
 block discarded – undo
114 120
 	 */
115 121
 	protected function getInstructions()
116 122
 	{
117
-		return array_filter( $this->metaboxes, function( $metabox ) {
123
+		return array_filter( $this->metaboxes, function( $metabox )
124
+		{
118 125
 			return $this->verifyMetaBoxCondition( $metabox['condition'] )
119 126
 				&& $this->hasPostType( $metabox );
120 127
 		});
@@ -183,7 +190,8 @@  discard block
 block discarded – undo
183 190
 			foreach( $conditions as $key ) {
184 191
 				$conditions[str_replace( '!', '', $key )] = substr( $key, 0, 1 ) == '!' ? 0 : 1;
185 192
 			}
186
-			$conditions = array_filter( $conditions, function( $key ) {
193
+			$conditions = array_filter( $conditions, function( $key )
194
+			{
187 195
 				return !is_numeric( $key );
188 196
 			}, ARRAY_FILTER_USE_KEY );
189 197
 		}
@@ -199,7 +207,8 @@  discard block
 block discarded – undo
199 207
 	 */
200 208
 	protected function normalizeFields( array $fields, array $data, $parentId )
201 209
 	{
202
-		return array_map( function( $id, $field ) use( $parentId ) {
210
+		return array_map( function( $id, $field ) use( $parentId )
211
+		{
203 212
 			$defaults =  [
204 213
 				'id' => $id,
205 214
 				'field_name' => '',
Please login to merge, or discard this patch.
src/Taxonomy.php 1 patch
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,10 +47,14 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function filterByTaxonomy( WP_Query $query )
49 49
 	{
50
-		if( !is_admin() || $this->app->screen()->base != 'edit' )return;
50
+		if( !is_admin() || $this->app->screen()->base != 'edit' ) {
51
+			return;
52
+		}
51 53
 		$vars = &$query->query_vars;
52 54
 		foreach( array_keys( $this->taxonomies ) as $taxonomy ) {
53
-			if( !isset( $vars[$taxonomy] ))return;
55
+			if( !isset( $vars[$taxonomy] )) {
56
+				return;
57
+			}
54 58
 			if( $term = get_term_by( 'id', $vars[$taxonomy], $taxonomy )) {
55 59
 				$vars[$taxonomy] = $term->slug;
56 60
 			}
@@ -66,7 +70,9 @@  discard block
 block discarded – undo
66 70
 	{
67 71
 		global $wp_query;
68 72
 		foreach( $this->taxonomies as $taxonomy => $args ) {
69
-			if( !in_array( get_current_screen()->post_type, $args['post_types'] ))continue;
73
+			if( !in_array( get_current_screen()->post_type, $args['post_types'] )) {
74
+				continue;
75
+			}
70 76
 			$selected = isset( $wp_query->query[$taxonomy] )
71 77
 				? $wp_query->query[$taxonomy]
72 78
 				: false;
@@ -87,7 +93,8 @@  discard block
 block discarded – undo
87 93
 	 */
88 94
 	public function register()
89 95
 	{
90
-		array_walk( $this->taxonomies, function( $args, $taxonomy ) {
96
+		array_walk( $this->taxonomies, function( $args, $taxonomy )
97
+		{
91 98
 			register_taxonomy( $taxonomy, $args['post_types'], array_diff_key( $args, array_flip( static::CUSTOM_KEYS )));
92 99
 			foreach( $args['post_types'] as $type ) {
93 100
 				register_taxonomy_for_object_type( $taxonomy, $type );
Please login to merge, or discard this patch.
src/Settings.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -130,7 +130,9 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	public function register( $metaboxes = [] )
132 132
 	{
133
-		if( $this->app->screen()->id != $this->hook )return;
133
+		if( $this->app->screen()->id != $this->hook ) {
134
+			return;
135
+		}
134 136
 		foreach( parent::register() as $metabox ) {
135 137
 			new SettingsMetaBox( $metabox );
136 138
 		}
@@ -202,7 +204,9 @@  discard block
 block discarded – undo
202 204
 	{
203 205
 		if( filter_input( INPUT_GET, 'page' ) !== $this->id
204 206
 			|| filter_input( INPUT_GET, 'action' ) !== 'reset'
205
-		)return;
207
+		) {
208
+			return;
209
+		}
206 210
 		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) {
207 211
 			update_option( $this->id, $this->getDefaults() );
208 212
 			return add_settings_error( $this->id, 'reset', __( 'Settings reset to defaults.', 'pollux' ), 'updated' );
@@ -216,7 +220,8 @@  discard block
 block discarded – undo
216 220
 	 */
217 221
 	protected function filterArrayByKey( array $array, $key )
218 222
 	{
219
-		return array_filter( $array, function( $value ) use( $key ) {
223
+		return array_filter( $array, function( $value ) use( $key )
224
+		{
220 225
 			return !empty( $value[$key] );
221 226
 		});
222 227
 	}
@@ -228,8 +233,10 @@  discard block
 block discarded – undo
228 233
 	{
229 234
 		$metaboxes = $this->filterArrayByKey( $this->metaboxes, 'slug' );
230 235
 
231
-		array_walk( $metaboxes, function( &$metabox ) {
232
-			$fields = array_map( function( $field ) {
236
+		array_walk( $metaboxes, function( &$metabox )
237
+		{
238
+			$fields = array_map( function( $field )
239
+			{
233 240
 				$field = wp_parse_args( $field, ['std' => ''] );
234 241
 				return [$field['slug'] => $field['std']];
235 242
 			}, $this->filterArrayByKey( $metabox['fields'], 'slug' ));
Please login to merge, or discard this patch.