11<?php
22
3+ use WP_CLI \CommandWithDBObject ;
4+ use WP_CLI \Entity \Utils as EntityUtils ;
5+ use WP_CLI \Fetchers \Post as PostFetcher ;
6+ use WP_CLI \Fetchers \User as UserFetcher ;
37use WP_CLI \Utils ;
48
59/**
2125 *
2226 * @package wp-cli
2327 */
24- class Post_Command extends WP_CLI \ CommandWithDBObject {
28+ class Post_Command extends CommandWithDBObject {
2529
2630 protected $ obj_type = 'post ' ;
2731 protected $ obj_fields = [
@@ -33,7 +37,7 @@ class Post_Command extends WP_CLI\CommandWithDBObject {
3337 ];
3438
3539 public function __construct () {
36- $ this ->fetcher = new \ WP_CLI \ Fetchers \ Post ();
40+ $ this ->fetcher = new PostFetcher ();
3741 }
3842
3943 /**
@@ -372,7 +376,7 @@ public function edit( $args, $_ ) {
372376 $ r = $ this ->_edit ( $ post ->post_content , "WP-CLI post {$ post ->ID }" );
373377
374378 if ( false === $ r ) {
375- \ WP_CLI ::warning ( 'No change made to post content. ' , 'Aborted ' );
379+ WP_CLI ::warning ( 'No change made to post content. ' , 'Aborted ' );
376380 } else {
377381 $ this ->update ( $ args , [ 'post_content ' => $ r ] );
378382 }
@@ -750,12 +754,12 @@ public function generate( $args, $assoc_args ) {
750754 }
751755
752756 if ( $ post_author ) {
753- $ user_fetcher = new \ WP_CLI \ Fetchers \ User ;
757+ $ user_fetcher = new UserFetcher ;
754758 $ post_author = $ user_fetcher ->get_check ( $ post_author )->ID ;
755759 }
756760
757761 if ( Utils \get_flag_value ( $ assoc_args , 'post_content ' ) ) {
758- if ( ! \ WP_CLI \ Entity \Utils ::has_stdin () ) {
762+ if ( ! EntityUtils ::has_stdin () ) {
759763 WP_CLI ::error ( 'The parameter `post_content` reads from STDIN. ' );
760764 }
761765
@@ -854,7 +858,7 @@ private function read_from_file_or_stdin( $arg ) {
854858 if ( '- ' !== $ arg ) {
855859 $ readfile = $ arg ;
856860 if ( ! file_exists ( $ readfile ) || ! is_file ( $ readfile ) ) {
857- \ WP_CLI ::error ( "Unable to read content from ' $ readfile'. " );
861+ WP_CLI ::error ( "Unable to read content from ' $ readfile'. " );
858862 }
859863 } else {
860864 $ readfile = 'php://stdin ' ;
0 commit comments