WP_CLI\Loggers
Regular::error_multi_line()
Similar to error( $message ), but outputs $message in a red box.
Метод класса: Regular{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$Regular = new Regular(); $Regular->error_multi_line( $message_lines );
- $message_lines(массив) (обязательный)
- Message to write.
Код Regular::error_multi_line() Regular::error multi line WP-CLI 2.8.0-alpha
public function error_multi_line( $message_lines ) { // Convert tabs to four spaces, as some shells will output the tabs as variable-length. $message_lines = array_map( function( $line ) { return str_replace( "\t", ' ', $line ); }, $message_lines ); $longest = max( array_map( 'strlen', $message_lines ) ); // Write an empty line before the message. $empty_line = Colors::colorize( '%w%1 ' . str_repeat( ' ', $longest ) . ' %n' ); $this->write( STDERR, "\n\t$empty_line\n" ); foreach ( $message_lines as $line ) { $padding = str_repeat( ' ', $longest - strlen( $line ) ); $line = Colors::colorize( "%w%1 $line $padding%n" ); $this->write( STDERR, "\t$line\n" ); } // Write an empty line after the message. $this->write( STDERR, "\t$empty_line\n\n" ); }