abstract class Fetcher {
- protected $msg;
-
/**
* @param string $msg The message to display when an item is not found
*/
- function __construct( $msg ) {
- $this->msg = $msg;
- }
+ protected $msg;
/**
* @param string $arg The raw CLI argument
class FetcherComment extends Fetcher {
+ protected $msg = "Comment with ID %s does not exist.";
+
public function get( $arg ) {
$comment_id = (int) $arg;
$comment = get_comment( $comment_id );
class FetcherPlugin extends Fetcher {
+ protected $msg = "The '%s' plugin could not be found.";
+
public function get( $name ) {
$plugins = get_plugins( '/' . $name );
class FetcherTheme extends Fetcher {
+ protected $msg = "The '%s' theme could not be found.";
+
public function get( $name ) {
$theme = wp_get_theme( $name );
class FetcherUser extends Fetcher {
+ protected $msg = "Invalid user ID or login: '%s'";
+
public function get( $id_or_login ) {
if ( is_numeric( $id_or_login ) )
$user = get_user_by( 'id', $id_or_login );
);
public function __construct() {
- $this->fetcher = new \WP_CLI\FetcherComment( "Comment with ID %s does not exist." );
+ $this->fetcher = new \WP_CLI\FetcherComment;
}
/**
parent::__construct();
- $this->fetcher = new \WP_CLI\FetcherPlugin( "The '%s' plugin could not be found." );
+ $this->fetcher = new \WP_CLI\FetcherPlugin;
}
protected function get_upgrader_class( $force ) {
function __construct() {
parent::__construct();
- $this->fetcher = new \WP_CLI\FetcherTheme( "The '%s' theme could not be found." );
+ $this->fetcher = new \WP_CLI\FetcherTheme;
}
protected function get_upgrader_class( $force ) {
);
public function __construct() {
- $this->fetcher = new \WP_CLI\FetcherUser( "Invalid user ID or login: '%s'" );
+ $this->fetcher = new \WP_CLI\FetcherUser;
}
/**