Skip to content

Commit ca02d28

Browse files
petitphpschlessera
authored andcommitted
Fix cs
1 parent 05424ec commit ca02d28

File tree

2 files changed

+45
-33
lines changed

2 files changed

+45
-33
lines changed

src/Cache_Command.php

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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

src/Transient_Command.php

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,15 @@ public function pluck( $args, $assoc_args ) {
442442
exit;
443443
}
444444

445-
$key_path = array_map( function( $key ) {
446-
if ( is_numeric( $key ) && ( $key === (string) intval( $key ) ) ) {
447-
return (int) $key;
448-
}
449-
return $key;
450-
}, array_slice( $args, 1 ) );
445+
$key_path = array_map(
446+
function( $key ) {
447+
if ( is_numeric( $key ) && ( (string) intval( $key ) === $key ) ) {
448+
return (int) $key;
449+
}
450+
return $key;
451+
},
452+
array_slice( $args, 1 )
453+
);
451454

452455
$traverser = new RecursiveDataStructureTraverser( $value );
453456

@@ -502,18 +505,21 @@ public function pluck( $args, $assoc_args ) {
502505
*/
503506
public function patch( $args, $assoc_args ) {
504507
list( $action, $key ) = $args;
505-
$expiration = (int) Utils\get_flag_value($assoc_args, 'expiration', 0);
508+
$expiration = (int) Utils\get_flag_value( $assoc_args, 'expiration', 0 );
506509

507510
$read_func = Utils\get_flag_value( $assoc_args, 'network' ) ? 'get_site_transient' : 'get_transient';
508-
$write_func = Utils\get_flag_value( $assoc_args, 'network' ) ? 'set_site_transient' : 'set_transient';
511+
$write_func = Utils\get_flag_value( $assoc_args, 'network' ) ? 'set_site_transient' : 'set_transient';
509512

510-
$key_path = array_map( function ( $key ) {
511-
if ( is_numeric( $key ) && ( $key === (string) intval( $key ) ) ) {
512-
return (int) $key;
513-
}
513+
$key_path = array_map(
514+
function ( $key ) {
515+
if ( is_numeric( $key ) && ( (string) intval( $key ) === $key ) ) {
516+
return (int) $key;
517+
}
514518

515-
return $key;
516-
}, array_slice( $args, 2 ) );
519+
return $key;
520+
},
521+
array_slice( $args, 2 )
522+
);
517523

518524
if ( 'delete' === $action ) {
519525
$patch_value = null;
@@ -526,9 +532,9 @@ public function patch( $args, $assoc_args ) {
526532
}
527533

528534
/* Need to make a copy of $current_value here as it is modified by reference */
529-
$old_value = $read_func( $key );
535+
$old_value = $read_func( $key );
530536
$current_value = $old_value;
531-
if ( is_object($old_value) ) {
537+
if ( is_object( $old_value ) ) {
532538
$current_value = clone $old_value;
533539
}
534540

0 commit comments

Comments
 (0)