Passed
Push — develop ( 646156...21669f )
by Paul
02:46
created
src/MetaBox/Instruction.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * @var array
17 17
 	 */
18
-	public $metaboxes = [];
18
+	public $metaboxes = [ ];
19 19
 
20 20
 	/**
21 21
 	 * @return void
@@ -24,18 +24,18 @@  discard block
 block discarded – undo
24 24
 	{
25 25
 		if( !count( array_filter( $this->metaboxes, function( $metabox ) {
26 26
 			return $this->show( false, $metabox );
27
-		})))return;
28
-		$this->metaboxes[] = [
27
+		}) ) )return;
28
+		$this->metaboxes[ ] = [
29 29
 			'id' => 'infodiv',
30 30
 			'post_types' => $this->getPostTypes(),
31 31
 			'title' => __( 'How to use in your theme', 'pollux' ),
32 32
 			'context' => 'side',
33 33
 			'priority' => 'low',
34
-			'fields' => [[
34
+			'fields' => [ [
35 35
 				'slug' => '',
36 36
 				'std' => $this->generateInstructions(),
37 37
 				'type' => 'custom_html',
38
-			]],
38
+			] ],
39 39
 		];
40 40
 	}
41 41
 
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 	protected function generateInstructions()
46 46
 	{
47 47
 		return array_reduce( $this->getInstructions(), function( $html, $metabox ) {
48
-			$fields = array_reduce( array_column( $metabox['fields'], 'slug' ), function( $html, $slug ) use( $metabox ) {
48
+			$fields = array_reduce( array_column( $metabox[ 'fields' ], 'slug' ), function( $html, $slug ) use( $metabox ) {
49 49
 				$hook = sprintf( 'pollux/%s/instruction', ( new Helper )->getClassname() );
50
-				return $html . apply_filters( $hook, "PostMeta::get('{$slug}');", $slug, $metabox['slug'] ) . PHP_EOL;
50
+				return $html . apply_filters( $hook, "PostMeta::get('{$slug}');", $slug, $metabox[ 'slug' ] ) . PHP_EOL;
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
 		});
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	protected function getInstructions()
63 63
 	{
64 64
 		return array_filter( $this->metaboxes, function( $metabox ) {
65
-			return $this->validate( $metabox['condition'] )
65
+			return $this->validate( $metabox[ 'condition' ] )
66 66
 				&& $this->hasPostType( $metabox );
67 67
 		});
68 68
 	}
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,9 +22,12 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	protected function addInstructions()
24 24
 	{
25
-		if( !count( array_filter( $this->metaboxes, function( $metabox ) {
25
+		if( !count( array_filter( $this->metaboxes, function( $metabox )
26
+		{
26 27
 			return $this->show( false, $metabox );
27
-		})))return;
28
+		}))) {
29
+			return;
30
+		}
28 31
 		$this->metaboxes[] = [
29 32
 			'id' => 'infodiv',
30 33
 			'post_types' => $this->getPostTypes(),
@@ -44,8 +47,10 @@  discard block
 block discarded – undo
44 47
 	 */
45 48
 	protected function generateInstructions()
46 49
 	{
47
-		return array_reduce( $this->getInstructions(), function( $html, $metabox ) {
48
-			$fields = array_reduce( array_column( $metabox['fields'], 'slug' ), function( $html, $slug ) use( $metabox ) {
50
+		return array_reduce( $this->getInstructions(), function( $html, $metabox )
51
+		{
52
+			$fields = array_reduce( array_column( $metabox['fields'], 'slug' ), function( $html, $slug ) use( $metabox )
53
+			{
49 54
 				$hook = sprintf( 'pollux/%s/instruction', ( new Helper )->getClassname() );
50 55
 				return $html . apply_filters( $hook, "PostMeta::get('{$slug}');", $slug, $metabox['slug'] ) . PHP_EOL;
51 56
 			});
@@ -61,7 +66,8 @@  discard block
 block discarded – undo
61 66
 	 */
62 67
 	protected function getInstructions()
63 68
 	{
64
-		return array_filter( $this->metaboxes, function( $metabox ) {
69
+		return array_filter( $this->metaboxes, function( $metabox )
70
+		{
65 71
 			return $this->validate( $metabox['condition'] )
66 72
 				&& $this->hasPostType( $metabox );
67 73
 		});
Please login to merge, or discard this patch.
src/Component.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
 	 * @param string $view
37 37
 	 * @return void
38 38
 	 */
39
-	public function render( $view, array $data = [] )
39
+	public function render( $view, array $data = [ ] )
40 40
 	{
41 41
 		$file = apply_filters( 'pollux/views/file',
42
-			$this->app->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))),
42
+			$this->app->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) ),
43 43
 			$view,
44 44
 			$data
45 45
 		);
46
-		if( file_exists( $file )) {
46
+		if( file_exists( $file ) ) {
47 47
 			extract( $data );
48 48
 			return include $file;
49 49
 		}
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 		$data = wp_parse_args( $data, $defaults );
59 59
 		foreach( $defaults as $key => $value ) {
60 60
 			$method = ( new Helper )->buildMethodName( $key, 'normalize' );
61
-			if( method_exists( $this, $method )) {
62
-				$data[$key] = $this->$method( $data[$key], $data, $id );
61
+			if( method_exists( $this, $method ) ) {
62
+				$data[ $key ] = $this->$method( $data[ $key ], $data, $id );
63 63
 			}
64 64
 		}
65 65
 		return $data;
Please login to merge, or discard this patch.