@@ -439,20 +439,23 @@ public function flush_group( $args, $assoc_args ) {
439439 */
440440 public function pluck ( $ args , $ assoc_args ) {
441441 list ($ key ) = $ args ;
442- $ group = Utils \get_flag_value ($ assoc_args , 'group ' );
442+ $ group = Utils \get_flag_value ( $ assoc_args , 'group ' );
443443
444444 $ value = wp_cache_get ( $ key , $ group );
445445
446446 if ( false === $ value ) {
447447 WP_CLI ::halt ( 1 );
448448 }
449449
450- $ key_path = array_map ( function ( $ key ) {
451- if ( is_numeric ( $ key ) && ( $ key === (string ) intval ( $ key ) ) ) {
452- return (int ) $ key ;
453- }
454- return $ key ;
455- }, array_slice ( $ args , 1 ) );
450+ $ key_path = array_map (
451+ function ( $ key ) {
452+ if ( is_numeric ( $ key ) && ( (string ) intval ( $ key ) === $ key ) ) {
453+ return (int ) $ key ;
454+ }
455+ return $ key ;
456+ },
457+ array_slice ( $ args , 1 )
458+ );
456459
457460 $ traverser = new RecursiveDataStructureTraverser ( $ value );
458461
@@ -511,16 +514,19 @@ public function pluck( $args, $assoc_args ) {
511514 */
512515 public function patch ( $ args , $ assoc_args ) {
513516 list ( $ action , $ key ) = $ args ;
514- $ group = Utils \get_flag_value ( $ assoc_args , 'group ' );
515- $ expiration = Utils \get_flag_value ( $ assoc_args , 'expiration ' );
517+ $ group = Utils \get_flag_value ( $ assoc_args , 'group ' );
518+ $ expiration = Utils \get_flag_value ( $ assoc_args , 'expiration ' );
516519
517- $ key_path = array_map ( function ( $ key ) {
518- if ( is_numeric ( $ key ) && ( $ key === (string ) intval ( $ key ) ) ) {
519- return (int ) $ key ;
520- }
520+ $ key_path = array_map (
521+ function ( $ key ) {
522+ if ( is_numeric ( $ key ) && ( (string ) intval ( $ key ) === $ key ) ) {
523+ return (int ) $ key ;
524+ }
521525
522- return $ key ;
523- }, array_slice ( $ args , 2 ) );
526+ return $ key ;
527+ },
528+ array_slice ( $ args , 2 )
529+ );
524530
525531 if ( 'delete ' === $ action ) {
526532 $ patch_value = null ;
@@ -533,9 +539,9 @@ public function patch( $args, $assoc_args ) {
533539 }
534540
535541 /* Need to make a copy of $current_value here as it is modified by reference */
536- $ old_value = wp_cache_get ($ key , $ group );
542+ $ old_value = wp_cache_get ( $ key , $ group );
537543 $ current_value = $ old_value ;
538- if (is_object ($ old_value) ) {
544+ if ( is_object ( $ old_value ) ) {
539545 $ current_value = clone $ old_value ;
540546 }
541547
0 commit comments