public static function run($line) { //Check to make sure we're not in a foreach else if (Generate::$elseExists) { Generate::$elseExists = false; return $line['start'] . '<?php endif; ?>' . $line['end']; } else { Generate::$inForeach = 0; return $line['start'] . '<?php endforeach; ?>' . $line['end']; } }
public static function run($line) { if (Generate::$inForeach && Generate::$inForeach > Generate::$inIf) { Generate::$elseExists = true; //Foreach else return $line['start'] . '<?php endforeach; if(empty($' . Generate::$foreachVar . ')) : ?>' . $line['end']; } if (Generate::$inIf && Generate::$inIf > Generate::$inForeach) { //If else return $line['start'] . '<?php else : ?>' . $line['end']; } }