Ejemplo n.º 1
0
 public function render($phpFile)
 {
     $first = true;
     $phpFile->addPageContent(PHPFile::PHP_OPENTAG);
     foreach ($this->condChain as $cond) {
         if ($first) {
             $phpFile->addPageContent('if (' . ExpressionParser::exprToPHP($cond[0], $phpFile, $this->origin) . ') {');
             $first = false;
         } else {
             if ($cond[0] !== true) {
                 $phpFile->addPageContent('else if (' . ExpressionParser::exprToPHP($cond[0], $phpFile, $this->origin) . ') {');
             } else {
                 $phpFile->addPageContent('else {');
             }
         }
         $phpFile->addPageContent(PHPFile::PHP_CLOSETAG);
         $cond[1]->render($phpFile);
         $phpFile->addPageContent(PHPFile::PHP_OPENTAG . '} ');
     }
     $phpFile->addPageContent(PHPFile::PHP_CLOSETAG);
 }
Ejemplo n.º 2
0
 public function render($phpFile)
 {
     $result = ExpressionParser::exprToPHP($this->expr, $phpFile, $this->origin);
     $phpFile->addPageContent(PHPFile::PHP_OPENTAG . 'if (is_bool($temp = (' . $result . '))) echo $temp ? "true" : "false"; else echo $temp;' . PHPFile::PHP_CLOSETAG);
 }