private function formatLine(&$message, $styles)
	{
		$style = array(
			'format'      => '0',
			'color'       => '',
			'indentation' => $this->defaultIndentation
		);

		// If array, parse for individual style declarations
		if (is_array($styles) && count($styles) > 0)
		{
			foreach ($styles as $k => $v)
			{
				switch ($k)
				{
					case 'color':
						$style['color'] = $this->translateColor($v);
						break;

					case 'format':
						$style['format'] = $this->translateFormat($v);
						break;

					case 'indentation':
						$style['indentation'] = '';
						for ($i=0; $i < $v; $i++)
						{
							$style['indentation'] .= ' ';
						}
						break;
				}
			}
		}
		// If string, parse for predefined formatting key words
		elseif (is_string($styles))
		{
			switch ($styles)
			{
				case 'warning':
					$style['color'] = '43';
					break;

				case 'error':
					$style['format'] = '1';
					$style['color']  = '41';
					break;

				case 'info':
					$style['color'] = $this->translateColor('blue');
					break;

				case 'success':
					$style['color'] = $this->translateColor('green');
					break;
			}
		}

		if (!Config::get('color', $this->colored))
		{
			$message = $style['indentation'] . $message;
		}
		else
		{
			$messageStyles  = $style['format'];
			$messageStyles .= ($style['color']) ? ';' . $style['color'] : '';
			$message        = chr(27) . "[" . $messageStyles . "m" . $style['indentation'] . $message . chr(27) . "[0m";
		}
	}
private function formatLine(&$message, $styles)
	{
		$style = array(
			'format'      => '0',
			'color'       => '',
			'indentation' => $this->defaultIndentation
		);

		// If array, parse for individual style declarations
		if (is_array($styles) && count($styles) > 0)
		{
			foreach ($styles as $k => $v)
			{
				switch ($k)
				{
					case 'color':
						$style['color'] = $this->translateColor($v);
						break;

					case 'format':
						$style['format'] = $this->translateFormat($v);
						break;

					case 'indentation':
						$style['indentation'] = '';
						for ($i=0; $i < $v; $i++)
						{
							$style['indentation'] .= ' ';
						}
						break;
				}
			}
		}
		// If string, parse for predefined formatting key words
		elseif (is_string($styles))
		{
			switch ($styles)
			{
				case 'warning':
					$style['color'] = '43';
					break;

				case 'error':
					$style['format'] = '1';
					$style['color']  = '41';
					break;

				case 'info':
					$style['color'] = $this->translateColor('blue');
					break;

				case 'success':
					$style['color'] = $this->translateColor('green');
					break;
			}
		}

		if (!Config::get('color', $this->colored))
		{
			$message = $style['indentation'] . $message;
		}
		else
		{
			$messageStyles  = $style['format'];
			$messageStyles .= ($style['color']) ? ';' . $style['color'] : '';
			$message        = chr(27) . "[" . $messageStyles . "m" . $style['indentation'] . $message . chr(27) . "[0m";
		}
	}
private function formatLine ( & $ message , $ styles ) { $ style = array ( 'format' => '0' , 'color' => '' , 'indentation' => $ this -> defaultIndentation ) ; // If array, parse for individual style declarations if ( is_array ( $ styles ) && count ( $ styles ) > 0 ) { foreach ( $ styles as $ k => $ v ) { switch ( $ k ) { case 'color' : $ style [ 'color' ] = $ this -> translateColor ( $ v ) ; break ; case 'format' : $ style [ 'format' ] = $ this -> translateFormat ( $ v ) ; break ; case 'indentation' : $ style [ 'indentation' ] = '' ; for ( $ i = 0 ; $ i < $ v ; $ i ++ ) { $ style [ 'indentation' ] .= ' ' ; } break ; } } } // If string, parse for predefined formatting key words elseif ( is_string ( $ styles ) ) { switch ( $ styles ) { case 'warning' : $ style [ 'color' ] = '43' ; break ; case 'error' : $ style [ 'format' ] = '1' ; $ style [ 'color' ] = '41' ; break ; case 'info' : $ style [ 'color' ] = $ this -> translateColor ( 'blue' ) ; break ; case 'success' : $ style [ 'color' ] = $ this -> translateColor ( 'green' ) ; break ; } } if ( ! Config :: get ( 'color' , $ this -> colored ) ) { $ message = $ style [ 'indentation' ] . $ message ; } else { $ messageStyles = $ style [ 'format' ] ; $ messageStyles .= ( $ style [ 'color' ] ) ? ';' . $ style [ 'color' ] : '' ; $ message = chr ( 27 ) . "[" . $ messageStyles . "m" . $ style [ 'indentation' ] . $ message . chr ( 27 ) . "[0m" ; } }
Take line of text and styles and give back a formatted line.

This will also translate textual colors and formatting words
to bash escape sequences.

@param   string  $message  Raw line of text
@param   mixed   $styles   String or array of styles
@return  void
Take line of text and styles and give back a formatted line .