@@ -99,7 +99,7 @@ public function list_( $args, $assoc_args ) {
9999 // Correct position inconsistency and
100100 // protected `url` param in WP-CLI
101101 $ items = array_map (
102- function ( $ item ) {
102+ function ( $ item ) {
103103 $ item ->position = $ item ->menu_order ;
104104 $ item ->link = $ item ->url ;
105105 return $ item ;
@@ -109,7 +109,7 @@ function( $item ) {
109109
110110 if ( ! empty ( $ assoc_args ['format ' ] ) && 'ids ' === $ assoc_args ['format ' ] ) {
111111 $ items = array_map (
112- function ( $ item ) {
112+ function ( $ item ) {
113113 return $ item ->db_id ;
114114 },
115115 $ items
@@ -118,7 +118,6 @@ function( $item ) {
118118
119119 $ formatter = $ this ->get_formatter ( $ assoc_args );
120120 $ formatter ->display_items ( $ items );
121-
122121 }
123122
124123 /**
@@ -343,7 +342,6 @@ public function update( $args, $assoc_args ) {
343342 }
344343 $ type = get_post_meta ( $ args [1 ], '_menu_item_type ' , true );
345344 $ this ->add_or_update_item ( 'update ' , $ type , $ args , $ assoc_args );
346-
347345 }
348346
349347 /**
@@ -375,7 +373,7 @@ public function delete( $args, $assoc_args ) {
375373 $ result = wp_delete_post ( $ arg , true );
376374 if ( ! $ result ) {
377375 WP_CLI ::warning ( "Couldn't delete menu item {$ arg }. " );
378- $ errors ++ ;
376+ ++ $ errors ;
379377 } else {
380378
381379 if ( is_array ( $ menu_term ) && ! empty ( $ menu_term ) && $ post ) {
@@ -395,9 +393,9 @@ public function delete( $args, $assoc_args ) {
395393 }
396394 }
397395
398- // phpcs:ignore WordPress.PHP .StrictComparisons.LooseComparison -- Will increase count for non existent menu.
396+ // phpcs:ignore Universal.Operators .StrictComparisons.LooseNotEqual -- Will increase count for non existent menu.
399397 if ( false != $ result ) {
400- $ count ++ ;
398+ ++ $ count ;
401399 }
402400 }
403401
@@ -505,15 +503,12 @@ private function add_or_update_item( $method, $type, $args, $assoc_args ) {
505503
506504 if ( 'add ' === $ method && ! empty ( $ assoc_args ['porcelain ' ] ) ) {
507505 WP_CLI ::line ( $ result );
508- } else {
509- if ( 'add ' === $ method ) {
506+ } elseif ( 'add ' === $ method ) {
510507 WP_CLI ::success ( 'Menu item added. ' );
511- } elseif ( 'update ' === $ method ) {
512- WP_CLI ::success ( 'Menu item updated. ' );
513- }
508+ } elseif ( 'update ' === $ method ) {
509+ WP_CLI ::success ( 'Menu item updated. ' );
514510 }
515511 }
516-
517512 }
518513
519514 /**
@@ -534,5 +529,4 @@ private function reorder_menu_items( $menu_id, $min_position, $increment, $ignor
534529 protected function get_formatter ( &$ assoc_args ) {
535530 return new Formatter ( $ assoc_args , $ this ->obj_fields );
536531 }
537-
538532}
0 commit comments