示例#1
0
    public function testBasicNl2Br()
    {
        $test = <<<ST
Ana are
mere.
ST;
        $this->assertEquals(nl2br($test), StringUtils::br2nl(nl2br($test)));
    }
示例#2
0
文件: vsc.php 项目: bogdananton/vsc
 public static function d()
 {
     $aRgs = func_get_args();
     $output = '';
     for ($i = 0; $i < ob_get_level(); $i++) {
         // cleaning the buffers
         ob_end_clean();
     }
     if (!self::isCLi() && self::getEnv()->getHttpRequest()->accepts('application/json')) {
         $output = json_encode($aRgs);
     } elseif (self::isCLi() || self::getEnv()->getHttpRequest()->accepts('text/html')) {
         foreach ($aRgs as $object) {
             ob_start();
             var_dump($object);
             $output .= ob_get_clean();
             if (!self::isCli()) {
                 $output .= '<hr/>' . "\n";
             }
         }
     }
     if (!stristr($_SERVER['PHP_SELF'], 'phpunit')) {
         ob_start();
         debug_print_backtrace();
         $output .= ob_get_clean();
         if (self::isCLi() || self::getEnv()->getHttpRequest()->accepts('application/json')) {
             echo StringUtils::stripTags(StringUtils::br2nl($output));
         } elseif (self::getEnv()->getHttpRequest()->accepts('text/html')) {
             echo '<pre>' . $output . '</pre>';
         } else {
             echo StringUtils::stripTags(StringUtils::br2nl($output));
         }
         exit;
     } else {
         return $output;
     }
 }