@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | * @param string $view |
36 | 36 | * @return void |
37 | 37 | */ |
38 | - public function render( $view, array $data = [] ) |
|
38 | + public function render( $view, array $data = [ ] ) |
|
39 | 39 | { |
40 | 40 | $file = apply_filters( 'pollux/views/file', |
41 | - $this->app->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))), |
|
41 | + $this->app->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) ), |
|
42 | 42 | $view, |
43 | 43 | $data |
44 | 44 | ); |
45 | - if( file_exists( $file )) { |
|
45 | + if( file_exists( $file ) ) { |
|
46 | 46 | extract( $data ); |
47 | 47 | return include $file; |
48 | 48 | } |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | $data = wp_parse_args( $data, $defaults ); |
58 | 58 | foreach( $defaults as $key => $value ) { |
59 | 59 | $method = $this->app->make( 'Helper' )->buildMethodName( $key, 'normalize' ); |
60 | - if( method_exists( $this, $method )) { |
|
61 | - $data[$key] = $this->$method( $data[$key], $data, $id ); |
|
60 | + if( method_exists( $this, $method ) ) { |
|
61 | + $data[ $key ] = $this->$method( $data[ $key ], $data, $id ); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | return $data; |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | protected function normalizeCondition( $conditions ) |
36 | 36 | { |
37 | 37 | $conditions = $this->app->make( 'Helper' )->toArray( $conditions ); |
38 | - if( count( array_filter( array_keys( $conditions ), 'is_string' )) == 0 ) { |
|
38 | + if( count( array_filter( array_keys( $conditions ), 'is_string' ) ) == 0 ) { |
|
39 | 39 | foreach( $conditions as $key ) { |
40 | - $conditions[str_replace( '!', '', $key )] = substr( $key, 0, 1 ) == '!' ? 0 : 1; |
|
40 | + $conditions[ str_replace( '!', '', $key ) ] = substr( $key, 0, 1 ) == '!' ? 0 : 1; |
|
41 | 41 | } |
42 | 42 | $conditions = array_filter( $conditions, function( $key ) { |
43 | 43 | return !is_numeric( $key ); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $hook = sprintf( 'pollux/%s/conditions', $this->app->make( 'Helper' )->getClassname() ); |
47 | 47 | return array_intersect_key( |
48 | 48 | $conditions, |
49 | - array_flip( apply_filters( $hook, static::$conditions )) |
|
49 | + array_flip( apply_filters( $hook, static::$conditions ) ) |
|
50 | 50 | ); |
51 | 51 | } |
52 | 52 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function validateIsFrontPage( $value ) |
94 | 94 | { |
95 | - return $value == ( $this->getPostId() == get_option( 'page_on_front' )); |
|
95 | + return $value == ( $this->getPostId() == get_option( 'page_on_front' ) ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected function validateIsHome( $value ) |
103 | 103 | { |
104 | - return $value == ( $this->getPostId() == get_option( 'page_for_posts' )); |
|
104 | + return $value == ( $this->getPostId() == get_option( 'page_for_posts' ) ); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | protected function validateIsPageTemplate( $value ) |
112 | 112 | { |
113 | - return basename( get_page_template_slug( $this->getPostId() )) == $value; |
|
113 | + return basename( get_page_template_slug( $this->getPostId() ) ) == $value; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -19,7 +19,8 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function validate( array $conditions ) |
21 | 21 | { |
22 | - array_walk( $conditions, function( &$value, $key ) { |
|
22 | + array_walk( $conditions, function( &$value, $key ) |
|
23 | + { |
|
23 | 24 | $method = $this->app->make( 'Helper' )->buildMethodName( $key, 'validate' ); |
24 | 25 | $value = method_exists( $this, $method ) |
25 | 26 | ? $this->$method( $value ) |
@@ -39,7 +40,8 @@ discard block |
||
39 | 40 | foreach( $conditions as $key ) { |
40 | 41 | $conditions[str_replace( '!', '', $key )] = substr( $key, 0, 1 ) == '!' ? 0 : 1; |
41 | 42 | } |
42 | - $conditions = array_filter( $conditions, function( $key ) { |
|
43 | + $conditions = array_filter( $conditions, function( $key ) |
|
44 | + { |
|
43 | 45 | return !is_numeric( $key ); |
44 | 46 | }, ARRAY_FILTER_USE_KEY ); |
45 | 47 | } |