Skip to content

Commit 26b9aff

Browse files
committed
96: Import Utils for much more handsome code
1 parent 4b0aa30 commit 26b9aff

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Theme_Mod_Command.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use \WP_CLI\Utils;
4+
35
/**
46
* Sets, gets, and removes theme mods.
57
*
@@ -77,11 +79,11 @@ class Theme_Mod_Command extends WP_CLI_Command {
7779
*/
7880
public function get( $args = array(), $assoc_args = array() ) {
7981

80-
if ( ! \WP_CLI\Utils\get_flag_value( $assoc_args, 'all' ) && empty( $args ) ) {
82+
if ( ! Utils\get_flag_value( $assoc_args, 'all' ) && empty( $args ) ) {
8183
WP_CLI::error( 'You must specify at least one mod or use --all.' );
8284
}
8385

84-
if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'all' ) ) {
86+
if ( Utils\get_flag_value( $assoc_args, 'all' ) ) {
8587
$args = array();
8688
}
8789

@@ -101,7 +103,7 @@ function ( $value, $key ) use ( &$mod_list, $separator ) {
101103
);
102104

103105
// Take our Formatter-friendly list and adjust it according to the requested format.
104-
switch ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'format' ) ) {
106+
switch ( Utils\get_flag_value( $assoc_args, 'format' ) ) {
105107
// For tables we use a double space to indent child items.
106108
case 'table':
107109
$mod_list = array_map(
@@ -257,11 +259,11 @@ public function list_( $args = array(), $assoc_args = array() ) {
257259
*/
258260
public function remove( $args = array(), $assoc_args = array() ) {
259261

260-
if ( ! \WP_CLI\Utils\get_flag_value( $assoc_args, 'all' ) && empty( $args ) ) {
262+
if ( ! Utils\get_flag_value( $assoc_args, 'all' ) && empty( $args ) ) {
261263
WP_CLI::error( 'You must specify at least one mod or use --all.' );
262264
}
263265

264-
if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'all' ) ) {
266+
if ( Utils\get_flag_value( $assoc_args, 'all' ) ) {
265267
remove_theme_mods();
266268
WP_CLI::success( 'Theme mods removed.' );
267269
return;

0 commit comments

Comments
 (0)