Passed
Push — develop ( 48f539...f5a1f6 )
by Paul
03:50
created
src/PostType/Columns.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 	/**
11 11
 	 * @var array
12 12
 	 */
13
-	public $columns = [];
13
+	public $columns = [ ];
14 14
 
15 15
 	/**
16 16
 	 * @var array
17 17
 	 */
18
-	public $types = [];
18
+	public $types = [ ];
19 19
 
20 20
 	/**
21 21
 	 * @var Application
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 	public function initColumns()
29 29
 	{
30 30
 		foreach( $this->types as $type => $args ) {
31
-			add_action( "manage_{$type}_posts_custom_column", [$this, 'printColumnValue'], 10, 2 );
31
+			add_action( "manage_{$type}_posts_custom_column", [ $this, 'printColumnValue' ], 10, 2 );
32 32
 			add_filter( "manage_{$type}_posts_columns", function( $columns ) use( $args ) {
33
-				return count( $args['columns'] ) > 1
34
-					? $args['columns']
33
+				return count( $args[ 'columns' ] ) > 1
34
+					? $args[ 'columns' ]
35 35
 					: $columns;
36 36
 			});
37 37
 		}
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	protected function getColumnImage( $postId )
59 59
 	{
60 60
 		if( has_post_thumbnail( $postId ) ) {
61
-			list( $src, $width, $height ) = wp_get_attachment_image_src( get_post_thumbnail_id( $postId ), [96, 48] );
61
+			list( $src, $width, $height ) = wp_get_attachment_image_src( get_post_thumbnail_id( $postId ), [ 96, 48 ] );
62 62
 			$image = sprintf( '<img src="%s" alt="%s" width="%s" height="%s">',
63
-				esc_url( set_url_scheme( $src )),
64
-				esc_attr( get_the_title( $postId )),
63
+				esc_url( set_url_scheme( $src ) ),
64
+				esc_attr( get_the_title( $postId ) ),
65 65
 				$width,
66 66
 				$height
67 67
 			);
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	protected function getColumnMedia()
78 78
 	{
79 79
 		return count( PostMeta::get( 'media', [
80
-			'fallback' => [],
80
+			'fallback' => [ ],
81 81
 			'single' => false,
82
-		]));
82
+		] ) );
83 83
 	}
84 84
 
85 85
 	/**
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	protected function normalizeColumns( array $columns )
98 98
 	{
99 99
 		$columns = array_flip( $columns );
100
-		$columns = array_merge( $columns, array_intersect_key( $this->columns, $columns ));
101
-		return ['cb' => '<input type="checkbox">'] + $columns;
100
+		$columns = array_merge( $columns, array_intersect_key( $this->columns, $columns ) );
101
+		return [ 'cb' => '<input type="checkbox">' ] + $columns;
102 102
 	}
103 103
 
104 104
 	/**
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	{
109 109
 		$comments = sprintf(
110 110
 			'<span class="vers comment-grey-bubble" title="%1$s"><span class="screen-reader-text">%1$s</span></span>',
111
-			$this->app->config['columns']['comments']
111
+			$this->app->config[ 'columns' ][ 'comments' ]
112 112
 		);
113
-		$columns = wp_parse_args( $this->app->config['columns'], [
113
+		$columns = wp_parse_args( $this->app->config[ 'columns' ], [
114 114
 			'comments' => $comments,
115
-		]);
115
+		] );
116 116
 		$this->columns = apply_filters( 'pollux/post_type/columns', $columns );
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
src/Helper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	public function buildClassName( $name, $path = '' )
15 15
 	{
16
-		$className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name )));
16
+		$className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name ) ) );
17 17
 		$className = implode( '', $className );
18 18
 		return !empty( $path )
19
-			? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className ))
19
+			? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className ) )
20 20
 			: $className;
21 21
 	}
22 22
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function buildMethodName( $name, $prefix = 'get' )
29 29
 	{
30
-		return lcfirst( $this->buildClassName( $prefix . '-' . $name ));
30
+		return lcfirst( $this->buildClassName( $prefix . '-' . $name ) );
31 31
 	}
32 32
 
33 33
 	/**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function startsWith( $needle, $haystack )
78 78
 	{
79
-		return substr( $haystack, 0, strlen( $needle )) === $needle;
79
+		return substr( $haystack, 0, strlen( $needle ) ) === $needle;
80 80
 	}
81 81
 
82 82
 	/**
Please login to merge, or discard this patch.
src/Controller.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function filterWordPressFooter( $text )
27 27
 	{
28
-		if( $this->app->config['remove_wordpress_footer'] )return;
28
+		if( $this->app->config[ 'remove_wordpress_footer' ] )return;
29 29
 		return $text;
30 30
 	}
31 31
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	{
38 38
 		$screenId = ( new Helper )->getCurrentScreen()->id;
39 39
 
40
-		if(( new Helper )->endsWith( sprintf( '_page_%s', Archive::id() ), $screenId )) {
40
+		if( ( new Helper )->endsWith( sprintf( '_page_%s', Archive::id() ), $screenId ) ) {
41 41
 			wp_enqueue_script( 'editor-expand' );
42 42
 			wp_enqueue_script( 'common' );
43 43
 			wp_enqueue_script( 'wp-lists' );
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 				wp_enqueue_script( 'jquery-touch-punch' );
47 47
 			}
48 48
 		}
49
-		if( $screenId == sprintf( 'toplevel_page_%s', Settings::id() )) {
49
+		if( $screenId == sprintf( 'toplevel_page_%s', Settings::id() ) ) {
50 50
 			wp_enqueue_script( 'common' );
51 51
 			wp_enqueue_script( 'wp-lists' );
52 52
 			wp_enqueue_script( 'postbox' );
53 53
 		}
54 54
 		wp_enqueue_style( 'pollux/main.css',
55 55
 			$this->app->url( 'assets/main.css' ),
56
-			apply_filters( 'pollux/enqueue/css/deps', [] ),
56
+			apply_filters( 'pollux/enqueue/css/deps', [ ] ),
57 57
 			$this->app->version
58 58
 		);
59 59
 		wp_enqueue_script( 'pollux/main.js',
60 60
 			$this->app->url( 'assets/main.js' ),
61
-			apply_filters( 'pollux/enqueue/js/deps', [] ),
61
+			apply_filters( 'pollux/enqueue/js/deps', [ ] ),
62 62
 			$this->app->version
63 63
 		);
64 64
 		wp_localize_script( 'pollux/main.js',
65 65
 			apply_filters( 'pollux/enqueue/js/localize/name', $this->app->id ),
66
-			apply_filters( 'pollux/enqueue/js/localize/variables', [] )
66
+			apply_filters( 'pollux/enqueue/js/localize/variables', [ ] )
67 67
 		);
68 68
 	}
69 69
 
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function removeDashboardWidgets()
75 75
 	{
76
-		if( !$this->app->config['remove_dashboard_widgets'] )return;
76
+		if( !$this->app->config[ 'remove_dashboard_widgets' ] )return;
77 77
 		$widgets = apply_filters( 'pollux/dashoard/widgets', [
78 78
 			'dashboard_primary',
79 79
 			'dashboard_quick_press',
80
-		]);
80
+		] );
81 81
 		foreach( $widgets as $widget ) {
82 82
 			remove_meta_box( $widget, 'dashboard', 'normal' );
83 83
 		}
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function removeWordPressMenu()
91 91
 	{
92
-		if( !$this->app->config['remove_wordpress_menu'] )return;
92
+		if( !$this->app->config[ 'remove_wordpress_menu' ] )return;
93 93
 		global $wp_admin_bar;
94 94
 		$wp_admin_bar->remove_menu( 'wp-logo' );
95 95
 	}
Please login to merge, or discard this patch.
src/MetaBox/Condition.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public static function conditions()
23 23
 	{
24
-		return apply_filters( 'pollux/conditions', static::$conditions, strtolower(( new Helper )->getClassname( static::class )));
24
+		return apply_filters( 'pollux/conditions', static::$conditions, strtolower( ( new Helper )->getClassname( static::class ) ) );
25 25
 	}
26 26
 
27 27
 	/**
@@ -45,18 +45,18 @@  discard block
 block discarded – undo
45 45
 	protected function normalizeCondition( $conditions )
46 46
 	{
47 47
 		$conditions = ( new Helper )->toArray( $conditions );
48
-		if( count( array_filter( array_keys( $conditions ), 'is_string' )) == 0 ) {
48
+		if( count( array_filter( array_keys( $conditions ), 'is_string' ) ) == 0 ) {
49 49
 			foreach( $conditions as $key ) {
50
-				$conditions[str_replace( '!', '', $key )] = substr( $key, 0, 1 ) == '!' ? 0 : 1;
50
+				$conditions[ str_replace( '!', '', $key ) ] = substr( $key, 0, 1 ) == '!' ? 0 : 1;
51 51
 			}
52 52
 			$conditions = array_filter( $conditions, function( $key ) {
53 53
 				return !is_numeric( $key );
54 54
 			}, ARRAY_FILTER_USE_KEY );
55 55
 		}
56
-		$hook = sprintf( 'pollux/%s/conditions', strtolower(( new Helper )->getClassname( $this )));
56
+		$hook = sprintf( 'pollux/%s/conditions', strtolower( ( new Helper )->getClassname( $this ) ) );
57 57
 		return array_intersect_key(
58 58
 			$conditions,
59
-			array_flip( apply_filters( $hook, static::conditions() ))
59
+			array_flip( apply_filters( $hook, static::conditions() ) )
60 60
 		);
61 61
 	}
62 62
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	protected function validateIsFrontPage( $value )
104 104
 	{
105
-		return $value == ( $this->getPostId() == get_option( 'page_on_front' ));
105
+		return $value == ( $this->getPostId() == get_option( 'page_on_front' ) );
106 106
 	}
107 107
 
108 108
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	protected function validateIsHome( $value )
113 113
 	{
114
-		return $value == ( $this->getPostId() == get_option( 'page_for_posts' ));
114
+		return $value == ( $this->getPostId() == get_option( 'page_for_posts' ) );
115 115
 	}
116 116
 
117 117
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function validateIsPageTemplate( $value )
122 122
 	{
123
-		return basename( get_page_template_slug( $this->getPostId() )) == $value;
123
+		return basename( get_page_template_slug( $this->getPostId() ) ) == $value;
124 124
 	}
125 125
 
126 126
 	/**
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 
31 31
 	public function __construct()
32 32
 	{
33
-		$this->file = realpath( dirname( dirname( __FILE__ )) . '/pollux.php' );
34
-		$this->gatekeeper = new GateKeeper( plugin_basename( $this->file ));
33
+		$this->file = realpath( dirname( dirname( __FILE__ ) ) . '/pollux.php' );
34
+		$this->gatekeeper = new GateKeeper( plugin_basename( $this->file ) );
35 35
 
36 36
 		$data = get_file_data( $this->file, array(
37 37
 			'id' => 'Text Domain',
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 
55 55
 		$controller = $this->make( 'Controller' );
56 56
 
57
-		add_action( 'admin_enqueue_scripts',      array( $controller, 'registerAssets' ));
58
-		add_action( 'admin_init',                 array( $controller, 'removeDashboardWidgets' ));
59
-		add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' ));
60
-		add_filter( 'admin_footer_text',          array( $controller, 'filterWordPressFooter' ));
57
+		add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' ) );
58
+		add_action( 'admin_init', array( $controller, 'removeDashboardWidgets' ) );
59
+		add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' ) );
60
+		add_filter( 'admin_footer_text', array( $controller, 'filterWordPressFooter' ) );
61 61
 
62 62
 		// Disallow indexing of the site on non-production environments
63 63
 		if( !$this->environment( 'production' ) && !is_admin() ) {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	public function environment( $checkFor = '' )
73 73
 	{
74 74
 		$environment = defined( 'WP_ENV' ) ? WP_ENV : 'production';
75
-		if( !empty( $checkFor )) {
75
+		if( !empty( $checkFor ) ) {
76 76
 			return $environment == $checkFor;
77 77
 		}
78 78
 		return $environment;
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function onActivation()
85 85
 	{
86
-		if( !get_option( Settings::id() )) {
87
-			update_option( Settings::id(), [] );
86
+		if( !get_option( Settings::id() ) ) {
87
+			update_option( Settings::id(), [ ] );
88 88
 		}
89 89
 	}
90 90
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function url( $path = '' )
112 112
 	{
113
-		return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ));
113
+		return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) );
114 114
 	}
115 115
 
116 116
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	{
121 121
 		Facade::clearResolvedInstances();
122 122
 		Facade::setFacadeApplication( $this );
123
-		$this->config = ( new Config( $this ))->get();
123
+		$this->config = ( new Config( $this ) )->get();
124 124
 		$this->registerAliases();
125 125
 		$classNames = array(
126 126
 			'MetaBox\MetaBox',
Please login to merge, or discard this patch.
src/PostType/Archive.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	 */
15 15
 	CONST ID = 'archives';
16 16
 
17
-	public $hooks = [];
17
+	public $hooks = [ ];
18 18
 
19 19
 	/**
20 20
 	 * {@inheritdoc}
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	{
24 24
 		parent::init();
25 25
 
26
-		add_action( 'pollux/archives/init',              [$this, 'registerFeaturedImageMetaBox'] );
27
-		add_action( 'pollux/archives/editor',            [$this, 'renderEditor'], 10, 2 );
28
-		add_filter( 'pollux/archives/metabox/submit',    [$this, 'filterSubmitMetaBox'] );
26
+		add_action( 'pollux/archives/init', [ $this, 'registerFeaturedImageMetaBox' ] );
27
+		add_action( 'pollux/archives/editor', [ $this, 'renderEditor' ], 10, 2 );
28
+		add_filter( 'pollux/archives/metabox/submit', [ $this, 'filterSubmitMetaBox' ] );
29 29
 		add_filter( 'pollux/archives/show/instructions', '__return_true' );
30 30
 	}
31 31
 
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
 	public function addPage()
37 37
 	{
38 38
 		foreach( $this->getPostTypesWithArchive() as $type => $page ) {
39
-			$labels = get_post_type_labels( get_post_type_object( $type ));
40
-			$this->hooks[$type] = call_user_func_array( 'add_submenu_page', $this->filter( 'page', [
39
+			$labels = get_post_type_labels( get_post_type_object( $type ) );
40
+			$this->hooks[ $type ] = call_user_func_array( 'add_submenu_page', $this->filter( 'page', [
41 41
 				$page,
42 42
 				sprintf( _x( '%s Archive', 'post archive', 'pollux' ), $labels->singular_name ),
43 43
 				__( 'Archive', 'pollux' ),
44 44
 				'edit_theme_options',
45 45
 				sprintf( '%s_archive', $type ),
46
-				[$this, 'renderPage'],
47
-			]));
46
+				[ $this, 'renderPage' ],
47
+			] ) );
48 48
 		}
49 49
 	}
50 50
 
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	public function filterBeforeInstructions()
56 56
 	{
57 57
 		return sprintf( '<pre class="my-sites nav-tab-active misc-pub-section">%s</pre>',
58
-			array_reduce( ['title', 'content', 'featured'], function( $instructions, $id ) {
59
-				return $instructions . $this->filterInstruction( null, ['slug' => $id], ['slug' => $this->getPostType()] ) . PHP_EOL;
58
+			array_reduce( [ 'title', 'content', 'featured' ], function( $instructions, $id ) {
59
+				return $instructions . $this->filterInstruction( null, [ 'slug' => $id ], [ 'slug' => $this->getPostType() ] ) . PHP_EOL;
60 60
 			})
61 61
 		);
62 62
 	}
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function filterInstruction( $instruction, array $field, array $metabox )
70 70
 	{
71
-		return sprintf( "ArchiveMeta::%s('%s');", $metabox['slug'], $field['slug'] );
71
+		return sprintf( "ArchiveMeta::%s('%s');", $metabox[ 'slug' ], $field[ 'slug' ] );
72 72
 	}
73 73
 
74 74
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	public function filterSubmitMetaBox( array $args )
79 79
 	{
80
-		$args[1] = __( 'Save Archive', 'pollux' );
80
+		$args[ 1 ] = __( 'Save Archive', 'pollux' );
81 81
 		return $args;
82 82
 	}
83 83
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	public function register()
89 89
 	{
90 90
 		$screenId = ( new Helper )->getCurrentScreen()->id;
91
-		if( in_array( $screenId, $this->hooks )) {
91
+		if( in_array( $screenId, $this->hooks ) ) {
92 92
 			$this->hook = $screenId;
93 93
 		}
94 94
 		parent::register();
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function registerFeaturedImageMetaBox()
102 102
 	{
103
-		if( !current_user_can( 'upload_files' ))return;
104
-		add_meta_box( 'postimagediv', __( 'Featured Image', 'pollux' ), [$this, 'renderFeaturedImageMetaBox'], null, 'side', 'low' );
103
+		if( !current_user_can( 'upload_files' ) )return;
104
+		add_meta_box( 'postimagediv', __( 'Featured Image', 'pollux' ), [ $this, 'renderFeaturedImageMetaBox' ], null, 'side', 'low' );
105 105
 	}
106 106
 
107 107
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 				'resize' => false,
122 122
 				'wp_autoresize_on' => true,
123 123
 			],
124
-		]);
124
+		] );
125 125
 	}
126 126
 
127 127
 	/**
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 	public function renderFeaturedImageMetaBox()
132 132
 	{
133 133
 		$imageId = ArchiveMeta::get( 'featured', -1, $this->getPostType() );
134
-		$imageSize = isset( wp_get_additional_image_sizes()['post-thumbnail'] )
134
+		$imageSize = isset( wp_get_additional_image_sizes()[ 'post-thumbnail' ] )
135 135
 			? 'post-thumbnail'
136
-			: [266, 266];
136
+			: [ 266, 266 ];
137 137
 		$thumbnail = get_post( $imageId )
138 138
 			? wp_get_attachment_image( $imageId, $imageSize )
139 139
 			: __( 'Set Featured Image', 'pollux' );
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			'remove_image' => __( 'Remove featured image', 'pollux' ),
147 147
 			'thickbox_url' => '',
148 148
 			'thumbnail' => $thumbnail,
149
-		]);
149
+		] );
150 150
 	}
151 151
 
152 152
 	/**
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 	public function renderPage()
157 157
 	{
158 158
 		$type = $this->getPostType();
159
-		if( empty( $type ))return;
160
-		$labels = get_post_type_labels( get_post_type_object( $type ));
159
+		if( empty( $type ) )return;
160
+		$labels = get_post_type_labels( get_post_type_object( $type ) );
161 161
 		$this->render( 'archive/index', [
162 162
 			'columns' => get_current_screen()->get_columns(),
163 163
 			'content' => ArchiveMeta::get( 'content', '', $type ),
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			'id' => static::id(),
166 166
 			'post_type' => $type,
167 167
 			'title' => ArchiveMeta::get( 'title', '', $type ),
168
-		]);
168
+		] );
169 169
 	}
170 170
 
171 171
 	/**
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	protected function getDefaults()
175 175
 	{
176
-		return [];
176
+		return [ ];
177 177
 	}
178 178
 
179 179
 	/**
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	{
195 195
 		$types = array_map( function( $value ) {
196 196
 			return sprintf( 'edit.php?post_type=%s', $value );
197
-		}, get_post_types( ['has_archive' => 1] ));
198
-		return array_merge( $types, ['post' => 'edit.php'] );
197
+		}, get_post_types( [ 'has_archive' => 1 ] ) );
198
+		return array_merge( $types, [ 'post' => 'edit.php' ] );
199 199
 	}
200 200
 
201 201
 	/**
Please login to merge, or discard this patch.
src/Settings/RWMetaBox.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 		$this->pollux_hook = $hook;
22 22
 		$this->pollux_id = $id;
23 23
 
24
-		remove_action( 'add_meta_boxes', [$this, 'add_meta_boxes'] );
25
-		remove_action( 'save_post_post', [$this, 'save_post'] );
24
+		remove_action( 'add_meta_boxes', [ $this, 'add_meta_boxes' ] );
25
+		remove_action( 'save_post_post', [ $this, 'save_post' ] );
26 26
 
27
-		add_action( 'pollux/archives/init', [$this, 'add_meta_boxes'] );
28
-		add_action( 'pollux/settings/init', [$this, 'add_meta_boxes'] );
29
-		add_filter( 'rwmb_field_meta',      [$this, '_get_field_meta'], 10, 3 );
27
+		add_action( 'pollux/archives/init', [ $this, 'add_meta_boxes' ] );
28
+		add_action( 'pollux/settings/init', [ $this, 'add_meta_boxes' ] );
29
+		add_filter( 'rwmb_field_meta', [ $this, '_get_field_meta' ], 10, 3 );
30 30
 	}
31 31
 
32 32
 	/**
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function _get_field_meta( $meta, array $field, $saved )
39 39
 	{
40
-		if( !$this->is_edit_screen() || !empty(( new Helper )->toArray( $meta )) || empty( $field['slug'] )) {
40
+		if( !$this->is_edit_screen() || !empty( ( new Helper )->toArray( $meta ) ) || empty( $field[ 'slug' ] ) ) {
41 41
 			return $meta;
42 42
 		}
43
-		$meta = call_user_func( [RWMB_Field::get_class_name( $field ), 'esc_meta'], ( $saved
44
-			? SiteMeta::get( $this->meta_box['slug'], $field['slug'], $meta )
45
-			: $field['std']
46
-		));
43
+		$meta = call_user_func( [ RWMB_Field::get_class_name( $field ), 'esc_meta' ], ( $saved
44
+			? SiteMeta::get( $this->meta_box[ 'slug' ], $field[ 'slug' ], $meta )
45
+			: $field[ 'std' ]
46
+		) );
47 47
 		return $this->_normalize_field_meta( $meta, $field );
48 48
 	}
49 49
 
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function _normalize_field_meta( $meta, array $field )
55 55
 	{
56
-		if( !empty( $meta ) && is_array( $meta )) {
56
+		if( !empty( $meta ) && is_array( $meta ) ) {
57 57
 			return $meta;
58 58
 		}
59
-		if( $field['clone'] ) {
60
-			return [''];
59
+		if( $field[ 'clone' ] ) {
60
+			return [ '' ];
61 61
 		}
62
-		if( $field['multiple'] ) {
63
-			return [];
62
+		if( $field[ 'multiple' ] ) {
63
+			return [ ];
64 64
 		}
65 65
 		return $meta;
66 66
 	}
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 	public function add_meta_boxes()
74 74
 	{
75 75
 		add_meta_box(
76
-			$this->meta_box['id'],
77
-			$this->meta_box['title'],
78
-			[$this, 'show'],
76
+			$this->meta_box[ 'id' ],
77
+			$this->meta_box[ 'title' ],
78
+			[ $this, 'show' ],
79 79
 			null,
80
-			$this->meta_box['context'],
81
-			$this->meta_box['priority']
80
+			$this->meta_box[ 'context' ],
81
+			$this->meta_box[ 'priority' ]
82 82
 		);
83 83
 	}
84 84
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	public function is_saved()
97 97
 	{
98 98
 		foreach( array_column( $this->fields, 'slug' ) as $field ) {
99
-			if( !is_null( SiteMeta::get( $this->meta_box['slug'], $field, null ))) {
99
+			if( !is_null( SiteMeta::get( $this->meta_box[ 'slug' ], $field, null ) ) ) {
100 100
 				return true;
101 101
 			}
102 102
 		}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public static function normalize( $metabox )
111 111
 	{
112
-		unset( $metabox['post_types'] );
113
-		return wp_parse_args( $metabox, ['slug' => ''] );
112
+		unset( $metabox[ 'post_types' ] );
113
+		return wp_parse_args( $metabox, [ 'slug' => '' ] );
114 114
 	}
115 115
 }
Please login to merge, or discard this patch.
src/MetaBox/PostMetaManager.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,19 +16,19 @@  discard block
 block discarded – undo
16 16
 	 * @param string $metaKey
17 17
 	 * @return mixed
18 18
 	 */
19
-	public function get( $metaKey, array $args = [] )
19
+	public function get( $metaKey, array $args = [ ] )
20 20
 	{
21
-		if( empty( $metaKey ))return;
21
+		if( empty( $metaKey ) )return;
22 22
 
23 23
 		$args = $this->normalize( $args );
24
-		$metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] );
25
-		$metaValue = get_post_meta( $args['id'], $metaKey, $args['single'] );
24
+		$metaKey = $this->buildMetaKey( $metaKey, $args[ 'prefix' ] );
25
+		$metaValue = get_post_meta( $args[ 'id' ], $metaKey, $args[ 'single' ] );
26 26
 
27
-		if( is_string( $metaValue )) {
27
+		if( is_string( $metaValue ) ) {
28 28
 			$metaValue = trim( $metaValue );
29 29
 		}
30 30
 		return empty( $metaValue )
31
-			? $args['fallback']
31
+			? $args[ 'fallback' ]
32 32
 			: $metaValue;
33 33
 	}
34 34
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	protected function buildMetaKey( $metaKey, $prefix )
41 41
 	{
42
-		return ( substr( $metaKey, 0, 1 ) == '_' && !empty( $prefix ))
42
+		return ( substr( $metaKey, 0, 1 ) == '_' && !empty( $prefix ) )
43 43
 			? sprintf( '_%s%s', rtrim( $prefix, '_' ), $metaKey )
44 44
 			: $prefix . $metaKey;
45 45
 	}
@@ -55,6 +55,6 @@  discard block
 block discarded – undo
55 55
 			'single'   => true,
56 56
 			'prefix'   => Application::prefix(),
57 57
 		];
58
-		return shortcode_atts( $defaults, array_change_key_case( $args ));
58
+		return shortcode_atts( $defaults, array_change_key_case( $args ) );
59 59
 	}
60 60
 }
Please login to merge, or discard this patch.
src/MetaBox/Instruction.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -23,19 +23,19 @@  discard block
 block discarded – undo
23 23
 	protected function addInstructions()
24 24
 	{
25 25
 		if( !$this->showInstructions() )return;
26
-		$this->normalize([
26
+		$this->normalize( [
27 27
 			'infodiv' => [
28 28
 				'context' => 'side',
29
-				'fields' => [[
29
+				'fields' => [ [
30 30
 					'slug' => '',
31 31
 					'std' => $this->generateInstructions(),
32 32
 					'type' => 'custom_html',
33
-				]],
33
+				] ],
34 34
 				'post_types' => $this->getPostTypes(),
35 35
 				'priority' => 'low',
36 36
 				'title' => __( 'How to use in your theme', 'pollux' ),
37 37
 			],
38
-		]);
38
+		] );
39 39
 	}
40 40
 
41 41
 	/**
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 	protected function generateInstructions()
45 45
 	{
46 46
 		$instructions = array_reduce( $this->getInstructions(), function( $html, $metabox ) {
47
-			$fields = array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox ) {
48
-				return $this->validate( $field['condition'] )
49
-					? $html . $this->filter( 'instruction', "PostMeta::get('{$field['slug']}');", $field, $metabox ) . PHP_EOL
47
+			$fields = array_reduce( $metabox[ 'fields' ], function( $html, $field ) use( $metabox ) {
48
+				return $this->validate( $field[ 'condition' ] )
49
+					? $html . $this->filter( 'instruction', "PostMeta::get('{$field[ 'slug' ]}');", $field, $metabox ) . PHP_EOL
50 50
 					: $html;
51 51
 			});
52 52
 			return $html . sprintf( '<p><strong>%s</strong></p><pre class="my-sites nav-tab-active misc-pub-section">%s</pre>',
53
-				$metabox['title'],
53
+				$metabox[ 'title' ],
54 54
 				$fields
55 55
 			);
56 56
 		});
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	protected function getInstructions()
64 64
 	{
65 65
 		return array_filter( $this->metaboxes, function( $metabox ) {
66
-			return $this->validate( $metabox['condition'] )
66
+			return $this->validate( $metabox[ 'condition' ] )
67 67
 				&& $this->hasPostType( $metabox );
68 68
 		});
69 69
 	}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	{
76 76
 		return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) {
77 77
 			return $this->show( false, $metabox );
78
-		})) > 0 );
78
+		}) ) > 0 );
79 79
 	}
80 80
 
81 81
 	/**
@@ -107,5 +107,5 @@  discard block
 block discarded – undo
107 107
 	/**
108 108
 	 * @return void
109 109
 	 */
110
-	abstract protected function normalize( array $metaboxes, array $defaults = [] );
110
+	abstract protected function normalize( array $metaboxes, array $defaults = [ ] );
111 111
 }
Please login to merge, or discard this patch.