controllers/shared/commandLine.php
protected function showMessage( $message, $in_mode = self::ALL, $params = NULL )
	{
		if ( isset( $params ) && is_array( $params ) )
		{
			$color_codes = '';
			$tabs = '';

			foreach ( $params as $key => $value )
			{
				switch ( $key )
				{
					case 'foreground':
						{
							$color_codes .= "\033[" . $this->_foreground_colors[$value] . "m";
						}break;

					case 'background':
						{
							$color_codes .= "\033[" . $this->_background_colors[$value] . "m";
						}break;

					case 'indent':
						{
							for ( $i = 0; $i < $value; $i++ )
							{
								$tabs = "\t" . $tabs;
							}
						}break;
				}
			}
			$message = $color_codes . "[" . $in_mode . "] " . $tabs . $message . "\033[0m";
		}
		else
		{
			$message = "[" . $in_mode . "] " . $message;
		}

		switch ( $in_mode )
		{
			case self::TEST:
				if ( $this->test )
				{
                    $this->addToOutput($message);
					echo $message . PHP_EOL;
				}
				break;
			case self::VERBOSE:
                $this->addToOutput($message);
                if ( $this->_verbose )
				{
					echo $message . PHP_EOL;
				}
				break;
			case self::ALL:
                $this->addToOutput($message);
				echo $message . PHP_EOL;
				break;
			default:
				throw new \OutOfBoundsException( 'Undefined in_mode selected.' );
		}
	}
protected function showMessage( $message, $in_mode = self::ALL, $params = NULL )
	{
		if ( isset( $params ) && is_array( $params ) )
		{
			$color_codes = '';
			$tabs = '';

			foreach ( $params as $key => $value )
			{
				switch ( $key )
				{
					case 'foreground':
						{
							$color_codes .= "\033[" . $this->_foreground_colors[$value] . "m";
						}break;

					case 'background':
						{
							$color_codes .= "\033[" . $this->_background_colors[$value] . "m";
						}break;

					case 'indent':
						{
							for ( $i = 0; $i < $value; $i++ )
							{
								$tabs = "\t" . $tabs;
							}
						}break;
				}
			}
			$message = $color_codes . "[" . $in_mode . "] " . $tabs . $message . "\033[0m";
		}
		else
		{
			$message = "[" . $in_mode . "] " . $message;
		}

		switch ( $in_mode )
		{
			case self::TEST:
				if ( $this->test )
				{
                    $this->addToOutput($message);
					echo $message . PHP_EOL;
				}
				break;
			case self::VERBOSE:
                $this->addToOutput($message);
                if ( $this->_verbose )
				{
					echo $message . PHP_EOL;
				}
				break;
			case self::ALL:
                $this->addToOutput($message);
				echo $message . PHP_EOL;
				break;
			default:
				throw new \OutOfBoundsException( 'Undefined in_mode selected.' );
		}
	}
protected function showMessage ( $ message , $ in_mode = self :: ALL , $ params = NULL ) { if ( isset ( $ params ) && is_array ( $ params ) ) { $ color_codes = '' ; $ tabs = '' ; foreach ( $ params as $ key => $ value ) { switch ( $ key ) { case 'foreground' : { $ color_codes .= "\033[" . $ this -> _foreground_colors [ $ value ] . "m" ; } break ; case 'background' : { $ color_codes .= "\033[" . $ this -> _background_colors [ $ value ] . "m" ; } break ; case 'indent' : { for ( $ i = 0 ; $ i < $ value ; $ i ++ ) { $ tabs = "\t" . $ tabs ; } } break ; } } $ message = $ color_codes . "[" . $ in_mode . "] " . $ tabs . $ message . "\033[0m" ; } else { $ message = "[" . $ in_mode . "] " . $ message ; } switch ( $ in_mode ) { case self :: TEST : if ( $ this -> test ) { $ this -> addToOutput ( $ message ) ; echo $ message . PHP_EOL ; } break ; case self :: VERBOSE : $ this -> addToOutput ( $ message ) ; if ( $ this -> _verbose ) { echo $ message . PHP_EOL ; } break ; case self :: ALL : $ this -> addToOutput ( $ message ) ; echo $ message . PHP_EOL ; break ; default : throw new \ OutOfBoundsException ( 'Undefined in_mode selected.' ) ; } }
Print a message on the console.

Usage example:

$this->showMessage( 'Example message', self::VERBOSE, array( 'background' => 'red', 'indent' => 4 ) );

@param string $message
@param string $in_mode (by default: self::ALL)
@param array $params (optional array keys: indent, foreground and background)
@throws \OutOfBoundsException
Print a message on the console .