You are here

public function Text_Template::setFile in Zircon Profile 8

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

Sets the template file.

Parameters

string $file:

Throws

InvalidArgumentException

1 call to Text_Template::setFile()
Text_Template::__construct in vendor/phpunit/php-text-template/src/Template.php
Constructor.

File

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

Class

Text_Template
A simple template engine.

Code

public function setFile($file) {
  $distFile = $file . '.dist';
  if (file_exists($file)) {
    $this->template = file_get_contents($file);
  }
  else {
    if (file_exists($distFile)) {
      $this->template = file_get_contents($distFile);
    }
    else {
      throw new InvalidArgumentException('Template file could not be loaded.');
    }
  }
}