Passed
Push — develop ( 5e8f92...83d763 )
by Paul
03:00
created
src/MetaBox/Condition.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,8 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function validate( array $conditions )
23 23
 	{
24
-		array_walk( $conditions, function( &$value, $key ) {
24
+		array_walk( $conditions, function( &$value, $key )
25
+		{
25 26
 			$method = ( new Helper )->buildMethodName( $key, 'validate' );
26 27
 			$value = method_exists( $this, $method )
27 28
 				? $this->$method( $value )
@@ -41,7 +42,8 @@  discard block
 block discarded – undo
41 42
 			foreach( $conditions as $key ) {
42 43
 				$conditions[str_replace( '!', '', $key )] = substr( $key, 0, 1 ) == '!' ? 0 : 1;
43 44
 			}
44
-			$conditions = array_filter( $conditions, function( $key ) {
45
+			$conditions = array_filter( $conditions, function( $key )
46
+			{
45 47
 				return !is_numeric( $key );
46 48
 			}, ARRAY_FILTER_USE_KEY );
47 49
 		}
Please login to merge, or discard this patch.
src/MetaBox/MetaBox.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -142,7 +142,8 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	protected function normalizeFields( array $fields, array $data, $parentId )
144 144
 	{
145
-		return array_map( function( $id, $field ) use( $parentId ) {
145
+		return array_map( function( $id, $field ) use( $parentId )
146
+		{
146 147
 			$defaults =  [
147 148
 				'attributes' => [],
148 149
 				'class' => '',
@@ -182,8 +183,11 @@  discard block
 block discarded – undo
182 183
 	{
183 184
 		$fields = &$metabox['fields'];
184 185
 		$depends = array_column( $fields, 'depends' );
185
-		array_walk( $depends, function( $value, $index ) use( &$fields, $metabox ) {
186
-			if( empty( $value ))return;
186
+		array_walk( $depends, function( $value, $index ) use( &$fields, $metabox )
187
+		{
188
+			if( empty( $value )) {
189
+				return;
190
+			}
187 191
 			$dependency = array_search( $value, array_column( $fields, 'id' ));
188 192
 			$fields[$index]['attributes']['data-depends'] = $value;
189 193
 			if( !$this->getValue( $fields[$dependency]['slug'], $metabox['slug'] )) {
Please login to merge, or discard this patch.
src/MetaBox/Instruction.php 1 patch
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	protected function addInstructions()
24 24
 	{
25
-		if( !$this->showInstructions() )return;
25
+		if( !$this->showInstructions() ) {
26
+			return;
27
+		}
26 28
 		$this->normalize([
27 29
 			'infodiv' => [
28 30
 				'context' => 'side',
@@ -43,8 +45,10 @@  discard block
 block discarded – undo
43 45
 	 */
44 46
 	protected function generateInstructions()
45 47
 	{
46
-		return array_reduce( $this->getInstructions(), function( $html, $metabox ) {
47
-			$fields = array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox ) {
48
+		return array_reduce( $this->getInstructions(), function( $html, $metabox )
49
+		{
50
+			$fields = array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox )
51
+			{
48 52
 				if( !$this->validate( $field['condition'] )) {
49 53
 					return $html;
50 54
 				}
@@ -63,7 +67,8 @@  discard block
 block discarded – undo
63 67
 	 */
64 68
 	protected function getInstructions()
65 69
 	{
66
-		return array_filter( $this->metaboxes, function( $metabox ) {
70
+		return array_filter( $this->metaboxes, function( $metabox )
71
+		{
67 72
 			return $this->validate( $metabox['condition'] )
68 73
 				&& $this->hasPostType( $metabox );
69 74
 		});
@@ -74,7 +79,8 @@  discard block
 block discarded – undo
74 79
 	 */
75 80
 	protected function showInstructions()
76 81
 	{
77
-		return count( array_filter( $this->metaboxes, function( $metabox ) {
82
+		return count( array_filter( $this->metaboxes, function( $metabox )
83
+		{
78 84
 			return $this->show( false, $metabox );
79 85
 		})) > 0;
80 86
 	}
Please login to merge, or discard this patch.
src/MetaBox/PostMetaManager.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function get( $metaKey, array $args = [] )
14 14
 	{
15
-		if( empty( $metaKey ))return;
15
+		if( empty( $metaKey )) {
16
+			return;
17
+		}
16 18
 
17 19
 		$args = $this->normalize( $args );
18 20
 		$metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] );
Please login to merge, or discard this patch.
src/Settings/Settings.php 1 patch
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -158,7 +158,9 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function register()
160 160
 	{
161
-		if(( new Helper )->getCurrentScreen()->id != $this->hook )return;
161
+		if(( new Helper )->getCurrentScreen()->id != $this->hook ) {
162
+			return;
163
+		}
162 164
 		foreach( parent::register() as $metabox ) {
163 165
 			new RWMetaBox( $metabox );
164 166
 		}
@@ -184,7 +186,9 @@  discard block
 block discarded – undo
184 186
 	 */
185 187
 	public function renderFooterScript()
186 188
 	{
187
-		if(( new Helper )->getCurrentScreen()->id != $this->hook )return;
189
+		if(( new Helper )->getCurrentScreen()->id != $this->hook ) {
190
+			return;
191
+		}
188 192
 		$this->render( 'settings/script', [
189 193
 			'confirm' => __( 'Are you sure want to do this?', 'pollux' ),
190 194
 			'hook' => $this->hook,
@@ -231,7 +235,9 @@  discard block
 block discarded – undo
231 235
 	{
232 236
 		if( filter_input( INPUT_GET, 'page' ) !== static::id()
233 237
 			|| filter_input( INPUT_GET, 'action' ) !== 'reset'
234
-		)return;
238
+		) {
239
+			return;
240
+		}
235 241
 		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) {
236 242
 			update_option( static::id(), $this->getDefaults() );
237 243
 			return add_settings_error( static::id(), 'reset', __( 'All values have been reset to defaults.', 'pollux' ), 'updated' );
@@ -245,7 +251,8 @@  discard block
 block discarded – undo
245 251
 	 */
246 252
 	protected function filterArrayByKey( array $array, $key )
247 253
 	{
248
-		return array_filter( $array, function( $value ) use( $key ) {
254
+		return array_filter( $array, function( $value ) use( $key )
255
+		{
249 256
 			return !empty( $value[$key] );
250 257
 		});
251 258
 	}
@@ -257,8 +264,10 @@  discard block
 block discarded – undo
257 264
 	{
258 265
 		$metaboxes = $this->filterArrayByKey( $this->metaboxes, 'slug' );
259 266
 
260
-		array_walk( $metaboxes, function( &$metabox ) {
261
-			$fields = array_map( function( $field ) {
267
+		array_walk( $metaboxes, function( &$metabox )
268
+		{
269
+			$fields = array_map( function( $field )
270
+			{
262 271
 				$field = wp_parse_args( $field, ['std' => ''] );
263 272
 				return [$field['slug'] => $field['std']];
264 273
 			}, $this->filterArrayByKey( $metabox['fields'], 'slug' ));
Please login to merge, or discard this patch.