Exemplo n.º 1
0
 public function testWTF()
 {
     $test = 'test';
     $times = 3;
     ob_start();
     StringUtils::_echo($test, $times);
     $output = ob_end_clean();
     $this->assertEquals(strlen($test) * $times, $output);
 }
Exemplo n.º 2
0
/* @var $this \vsc\presentation\views\JsonView  */
$aArray = $model->toArray();
$mEnd = end($aArray);
$sEndKey = key($aArray);
foreach ($aArray as $sName => $mValue) {
    if (is_scalar($mValue)) {
        StringUtils::_echo("\t", $GLOBALS['depth']);
        if (!is_int($sName)) {
            echo '"' . $sName . '": ';
        }
        echo '"' . StringUtils::stripEntities(str_replace('"', '\\"', $mValue)) . '"' . ($sName != $sEndKey ? ',' : '') . "\n";
        continue;
    } elseif (is_array($mValue)) {
        $mValue = new ArrayModel($mValue);
    }
    if (ModelA::isValid($mValue)) {
        $this->setModel($mValue);
        StringUtils::_echo("\t", $GLOBALS['depth']);
        echo '"' . $sName . '": ';
        echo '{' . "\n";
        $GLOBALS['depth']++;
        echo $this->fetch(__FILE__);
        StringUtils::_echo("\t", $GLOBALS['depth'] - 1);
        echo '}' . ($sName != $sEndKey && $mEnd != $mValue ? ',' : '') . "\n";
        $GLOBALS['depth']--;
        continue;
    }
    StringUtils::_echo("\t", $GLOBALS['depth']);
    echo '"' . $sName . '" : ';
    echo '"' . var_export($mValue, true) . '"' . ($sName != $sEndKey ? ',' : '') . "\n";
}