Horde_Cli::message PHP Method

message() public method

Displays a message.
public message ( $message, string $type = 'cli.message' )
$type string The type of message: 'cli.error', 'cli.warning', 'cli.success', or 'cli.message'.
    public function message($message, $type = 'cli.message')
    {
        $message = wordwrap(str_replace("\n", "\n           ", $message), 68, "\n           ", true);
        switch ($type) {
            case 'cli.error':
                $type_message = $this->red('[ ERROR! ] ');
                break;
            case 'cli.warning':
                $type_message = $this->yellow('[  WARN  ] ');
                break;
            case 'cli.success':
                $type_message = $this->green('[   OK   ] ');
                break;
            case 'cli.message':
                $type_message = $this->blue('[  INFO  ] ');
                break;
            default:
                $type_message = '';
        }
        $this->writeln($type_message . $message);
    }

Usage Example

Example #1
0
 public function pear($text)
 {
     if (!$this->_verbose) {
         return;
     }
     $this->_cli->message('-------------------------------------------------', $this->_getType('cli.message'));
     $this->_cli->message('PEAR output START', $this->_getType('cli.message'));
     $this->_cli->message('-------------------------------------------------', $this->_getType('cli.message'));
     $this->_cli->writeln($text);
     $this->_cli->message('-------------------------------------------------', $this->_getType('cli.message'));
     $this->_cli->message('PEAR output END', $this->_getType('cli.message'));
     $this->_cli->message('-------------------------------------------------', $this->_getType('cli.message'));
 }
All Usage Examples Of Horde_Cli::message