コード例 #1
0
ファイル: testing.php プロジェクト: bermi/akelos
function ak_testing_error_handler($error_number, $error_message, $file, $line)
{
    $error_number = $error_number & error_reporting();
    if ($error_number == 0) {
        return false;
    }
    throw new Exception(AkAnsiColor::style($error_message, 'error'));
}
コード例 #2
0
ファイル: ansi.php プロジェクト: bermi/akelos
 /**
  * Returns a text escaped with an ANSI code.
  * 
  * By default there are 3 styles defined
  * 
  * * error      \033[41;37;1m%s\033[0m  Red background, White foreground and bold text
  * * info       \033[32;1m%s\033[0m     Green foreground and bold text
  * * comment    \033[33m%s\033[0m       Yellow foreground
  * 
  * You can create more styles by setting the configuration option ansi_styles
  * 
  * <code>
  *  AkConfig::setOption('ansi_styles', array('stylename' => '\033[33m%s\033[0m'))
  * </code>
  * 
  * ANSI codes can be used on console scripts.
  * 
  * It can also be disabled by defining AK_AVOID_ANSI_CONSOLE_COLORS to true.
  * 
  * More details on color codes at http://en.wikipedia.org/wiki/ANSI_escape_code
  *
  * @param unknown_type $text
  * @param unknown_type $style_name
  * @return unknown
  */
 public static function style($text, $style_name, $padding = 5)
 {
     if (!AkAnsiColor::isSupported()) {
         return $text;
     }
     $styles = array_merge(array('error' => "%s", 'warning' => "%s", 'success' => "%s", 'info' => "%s", 'comment' => "%s"), AkConfig::getOption('ansi_styles', array()));
     return isset($styles[$style_name]) ? sprintf($styles[$style_name], $text) : $text;
 }
コード例 #3
0
ファイル: base.php プロジェクト: bermi/akelos
 static function display($message, $style = null, $padding = 0)
 {
     echo AkAnsiColor::style($message, $style, $padding);
 }
コード例 #4
0
ファイル: base.php プロジェクト: bermi/akelos
 public function paintSkip($message)
 {
     parent::paintSkip(AkAnsiColor::style($message, 'warning'));
 }