WP_CLI\Loggers

Base::_line()protectedWP-CLI 1.0

Output one line of message to a resource.

Method of the class: Base{}

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->_line( $message, $label, $color, $handle ) // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore -- Used in third party extensions.;
$message(string) (required)
Message to write.
$label(string) (required)
Prefix message with a label.
$color(string) (required)
Colorize label with a given color.
$handle(resource)
Resource to write to.
Default: STDOUT

Base::_line() code WP-CLI 2.8.0-alpha

protected function _line( $message, $label, $color, $handle = STDOUT ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore -- Used in third party extensions.
	if ( class_exists( 'cli\Colors' ) ) {
		$label = Colors::colorize( "$color$label:%n", $this->in_color );
	} else {
		$label = "$label:";
	}
	$this->write( $handle, "$label $message\n" );
}