Passed
Push — master ( 5f0760...eb71ac )
by Paul
02:39
created
src/MetaBox.php 1 patch
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -59,7 +59,8 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function verifyMetaBoxCondition( array $conditions )
61 61
 	{
62
-		array_walk( $conditions, function( &$value, $key ) {
62
+		array_walk( $conditions, function( &$value, $key )
63
+		{
63 64
 			$method = $this->app->buildMethodName( $key, 'validate' );
64 65
 			$value = method_exists( $this, $method )
65 66
 				? $this->$method( $value )
@@ -70,9 +71,12 @@  discard block
 block discarded – undo
70 71
 
71 72
 	protected function addInstructions()
72 73
 	{
73
-		if( !count( array_filter( $this->metaboxes, function( $metabox ) {
74
+		if( !count( array_filter( $this->metaboxes, function( $metabox )
75
+		{
74 76
 			return $this->isVisible( false, $metabox );
75
-		})))return;
77
+		}))) {
78
+			return;
79
+		}
76 80
 		$this->metaboxes[] = [
77 81
 			'id' => 'infodiv',
78 82
 			'post_types' => $this->getPostTypes(),
@@ -91,8 +95,10 @@  discard block
 block discarded – undo
91 95
 	 */
92 96
 	protected function generateInstructions()
93 97
 	{
94
-		return array_reduce( $this->getInstructions(), function( $html, $metabox ) {
95
-			$fields = array_reduce( array_column( $metabox['fields'], 'slug' ), function( $html, $slug ) use( $metabox ) {
98
+		return array_reduce( $this->getInstructions(), function( $html, $metabox )
99
+		{
100
+			$fields = array_reduce( array_column( $metabox['fields'], 'slug' ), function( $html, $slug ) use( $metabox )
101
+			{
96 102
 				$hook = sprintf( 'pollux/%s/instruction', $this->getClassname() );
97 103
 				return $html . apply_filters( $hook, "PostMeta::get('{$slug}');", $slug, $metabox['slug'] ) . PHP_EOL;
98 104
 			});
@@ -108,7 +114,8 @@  discard block
 block discarded – undo
108 114
 	 */
109 115
 	protected function getInstructions()
110 116
 	{
111
-		return array_filter( $this->metaboxes, function( $metabox ) {
117
+		return array_filter( $this->metaboxes, function( $metabox )
118
+		{
112 119
 			return $this->verifyMetaBoxCondition( $metabox['condition'] )
113 120
 				&& $this->hasPostType( $metabox );
114 121
 		});
@@ -178,7 +185,8 @@  discard block
 block discarded – undo
178 185
 			foreach( $conditions as $key ) {
179 186
 				$conditions[str_replace( '!', '', $key )] = substr( $key, 0, 1 ) == '!' ? 0 : 1;
180 187
 			}
181
-			$conditions = array_filter( $conditions, function( $key ) {
188
+			$conditions = array_filter( $conditions, function( $key )
189
+			{
182 190
 				return !is_numeric( $key );
183 191
 			}, ARRAY_FILTER_USE_KEY );
184 192
 		}
@@ -194,7 +202,8 @@  discard block
 block discarded – undo
194 202
 	 */
195 203
 	protected function normalizeFields( array $fields, array $data, $parentId )
196 204
 	{
197
-		return array_map( function( $id, $field ) use( $parentId ) {
205
+		return array_map( function( $id, $field ) use( $parentId )
206
+		{
198 207
 			$defaults =  [
199 208
 				'id' => $id,
200 209
 				'field_name' => '',
Please login to merge, or discard this patch.
src/Taxonomy.php 1 patch
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,13 +46,18 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function filterBy( WP_Query $query )
48 48
 	{
49
-		if( !is_admin() || get_current_screen()->base != 'edit' )return;
49
+		if( !is_admin() || get_current_screen()->base != 'edit' ) {
50
+			return;
51
+		}
50 52
 
51 53
 		$vars = &$query->query_vars;
52 54
 		$taxonomies = array_keys( $this->taxonomies );
53 55
 
54
-		array_walk( $taxonomies, function( $taxonomy ) use( &$vars ) {
55
-			if( !isset( $vars[$taxonomy] ))return;
56
+		array_walk( $taxonomies, function( $taxonomy ) use( &$vars )
57
+		{
58
+			if( !isset( $vars[$taxonomy] )) {
59
+				return;
60
+			}
56 61
 			if( $term = get_term_by( 'id', $vars[$taxonomy], $taxonomy )) {
57 62
 				$vars[$taxonomy] = $term->slug;
58 63
 			}
@@ -67,7 +72,9 @@  discard block
 block discarded – undo
67 72
 	{
68 73
 		global $wp_query;
69 74
 		foreach( $this->taxonomies as $taxonomy => $args ) {
70
-			if( !in_array( get_current_screen()->post_type, $args['post_types'] ))continue;
75
+			if( !in_array( get_current_screen()->post_type, $args['post_types'] )) {
76
+				continue;
77
+			}
71 78
 			$selected = isset( $wp_query->query[$taxonomy] )
72 79
 				? $wp_query->query[$taxonomy]
73 80
 				: false;
@@ -87,7 +94,8 @@  discard block
 block discarded – undo
87 94
 	 */
88 95
 	public function register()
89 96
 	{
90
-		array_walk( $this->taxonomies, function( $args, $taxonomy ) {
97
+		array_walk( $this->taxonomies, function( $args, $taxonomy )
98
+		{
91 99
 			register_taxonomy( $taxonomy, $args['post_types'], array_diff_key( $args, array_flip( self::CUSTOM_KEYS )));
92 100
 			foreach( $args['post_types'] as $type ) {
93 101
 				register_taxonomy_for_object_type( $taxonomy, $type );
Please login to merge, or discard this patch.