create(); $this->add_command( $this->getFullCommand( $command ), $command ); } } /** * @param string $command_text The subcommand. * @param callable $command Command implementation as a class, function or closure. * * @throws \Exception The exception thrown by \WP_CLI::add_command. */ private function add_command( $command_text, $command ) { \WP_CLI::add_command( $command_text, $command ); } /** * @param ICommand $command Command implementation as a class, function or closure. * * @return string The sub command prefixed by the top-level command (all trimmed). */ private function getFullCommand( $command ) { return trim( self::MAIN_COMMAND . ' ' . $command->get_command() ); } }