parser = $parser; $this->baseDir = $baseDir; $this->suffix = $suffix; } /** * Loads the template with the specified name. * * @param string $name The name of template * * @return Template The loaded template */ public function load($name) { $file = $this->baseDir . '/' . $name . $this->suffix; if (!is_file($file)) { throw new \InvalidArgumentException( sprintf('The file "%s" does not exist', $file) ); } return new Template($this->parser, file_get_contents($file)); } }