You are here

public function Text_Template::renderTo in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/php-text-template/src/Template.php \Text_Template::renderTo()

Renders the template and writes the result to a file.

Parameters

string $target:

File

vendor/phpunit/php-text-template/src/Template.php, line 112

Class

Text_Template
A simple template engine.

Code

public function renderTo($target) {
  $fp = @fopen($target, 'wt');
  if ($fp) {
    fwrite($fp, $this
      ->render());
    fclose($fp);
  }
  else {
    $error = error_get_last();
    throw new RuntimeException(sprintf('Could not write to %s: %s', $target, substr($error['message'], strpos($error['message'], ':') + 2)));
  }
}