Skip to content

Commit 4b1ba25

Browse files
committed
Reuse has_stdin() from framework
1 parent e118963 commit 4b1ba25

File tree

6 files changed

+6
-32
lines changed

6 files changed

+6
-32
lines changed

src/Option_Command.php

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

3-
use WP_CLI\Entity\Utils as EntityUtils;
43
use WP_CLI\Formatter;
54
use WP_CLI\Traverser\RecursiveDataStructureTraverser;
65
use WP_CLI\Utils;
@@ -682,7 +681,7 @@ function ( $key ) {
682681
if ( 'delete' === $action ) {
683682
$patch_value = null;
684683
} else {
685-
$stdin_value = EntityUtils::has_stdin()
684+
$stdin_value = Utils\has_stdin()
686685
? trim( WP_CLI::get_value_from_arg_or_stdin( $args, -1 ) )
687686
: null;
688687

src/Post_Command.php

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

33
use WP_CLI\CommandWithDBObject;
4-
use WP_CLI\Entity\Utils as EntityUtils;
54
use WP_CLI\Fetchers\Post as PostFetcher;
65
use WP_CLI\Fetchers\User as UserFetcher;
76
use WP_CLI\Utils;
@@ -795,7 +794,7 @@ public function generate( $args, $assoc_args ) {
795794
}
796795

797796
if ( Utils\get_flag_value( $assoc_args, 'post_content' ) ) {
798-
if ( ! EntityUtils::has_stdin() ) {
797+
if ( ! Utils\has_stdin() ) {
799798
WP_CLI::error( 'The parameter `post_content` reads from STDIN.' );
800799
}
801800

src/Site_Option_Command.php

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

3-
use WP_CLI\Entity\Utils as EntityUtils;
43
use WP_CLI\Formatter;
54
use WP_CLI\Traverser\RecursiveDataStructureTraverser;
65
use WP_CLI\Utils;
@@ -372,7 +371,7 @@ function ( $key ) {
372371
if ( 'delete' === $action ) {
373372
$patch_value = null;
374373
} else {
375-
$stdin_value = EntityUtils::has_stdin()
374+
$stdin_value = Utils\has_stdin()
376375
? trim( WP_CLI::get_value_from_arg_or_stdin( $args, -1 ) )
377376
: null;
378377
$patch_value = ! empty( $stdin_value )

src/User_Command.php

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

33
use WP_CLI\CommandWithDBObject;
4-
use WP_CLI\Entity\Utils as EntityUtils;
54
use WP_CLI\Fetchers\User as UserFetcher;
65
use WP_CLI\Formatter;
76
use WP_CLI\Iterators\CSV as CsvIterator;
@@ -964,7 +963,7 @@ public function import_csv( $args, $assoc_args ) {
964963
WP_CLI::error( "Couldn't access remote CSV file (HTTP {$response_code} response)." );
965964
}
966965
} elseif ( '-' === $filename ) {
967-
if ( ! EntityUtils::has_stdin() ) {
966+
if ( ! Utils\has_stdin() ) {
968967
WP_CLI::error( 'Unable to read content from STDIN.' );
969968
}
970969
} elseif ( ! file_exists( $filename ) ) {

src/WP_CLI/CommandWithMeta.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
use Exception;
66
use WP_CLI;
77
use WP_CLI_Command;
8-
use WP_CLI\Entity\Utils as EntityUtils;
98
use WP_CLI\Traverser\RecursiveDataStructureTraverser;
9+
use WP_CLI\Utils;
1010

1111
/**
1212
* Base class for WP-CLI commands that deal with metadata
@@ -412,7 +412,7 @@ function ( $key ) {
412412
if ( 'delete' === $action ) {
413413
$patch_value = null;
414414
} else {
415-
$stdin_value = EntityUtils::has_stdin()
415+
$stdin_value = Utils\has_stdin()
416416
? trim( WP_CLI::get_value_from_arg_or_stdin( $args, -1 ) )
417417
: null;
418418
$patch_value = ! empty( $stdin_value )

src/WP_CLI/Entity/Utils.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)