WP_CLI::error_multi_line PHP Method

error_multi_line() public static method

Error message is written to STDERR.
public static error_multi_line ( $message_lines )
    public static function error_multi_line($message_lines)
    {
        if (!isset(self::get_runner()->assoc_args['completions']) && is_array($message_lines)) {
            self::$logger->error_multi_line(array_map(array(__CLASS__, 'error_to_string'), $message_lines));
        }
    }

Usage Example

コード例 #1
0
 protected static function fetch_tarball_via_oauth($key, $secret, $uri)
 {
     try {
         $oauth = new OAuth($key, $secret);
         $oauth->fetch($uri);
         WP_CLI::debug($oauth->getLastResponseHeaders());
         $headers = http_parse_headers($oauth->getLastResponseHeaders());
         $mime_type = self::parse_content_type_header($headers['Content-Type']);
         $content_disposition = self::parse_content_disposition_header($headers['Content-Disposition']);
         $filename = empty($content_disposition['filename']) ? $filename = tmpfile() : sys_get_temp_dir() . DIRECTORY_SEPARATOR . $content_disposition['filename'];
         file_put_contents($filename, $oauth->getLastResponse());
         return $filename;
     } catch (OAuthException $e) {
         WP_CLI::error_multi_line($e->getMessage(), true);
     }
     WP_CLI::error('Unknown error', true);
 }
All Usage Examples Of WP_CLI::error_multi_line