/**
  * {@inheritdoc}
  */
 public function load()
 {
     if (self::is_cached($this->hashed_content)) {
         return self::get_cached_template($this->hashed_content);
     } else {
         $parser = new TemplateSyntaxParser();
         $parsed_content = $parser->parse($this->content);
         self::register_cached_template($this->hashed_content, $parsed_content);
         return $parsed_content;
     }
 }
 private function assert_parse($expected, $input)
 {
     $parser = new TemplateSyntaxParser();
     $output = $parser->parse($input);
     $this->assertEquals($expected, $output);
 }
 private function generate_cache_file()
 {
     $real_file_content = @file_get_contents($this->real_filepath);
     if ($real_file_content === false) {
         throw new FileTemplateLoadingException($this->filepath, $this->real_filepath);
     }
     $parser = new TemplateSyntaxParser();
     $result = $parser->parse($real_file_content);
     try {
         $cache_file = new File($this->cache_filepath);
         $cache_file->open(File::WRITE);
         $cache_file->lock();
         $cache_file->write($result);
         $cache_file->unlock();
         $cache_file->close();
         $cache_file->change_chmod(0666);
     } catch (IOException $ex) {
         throw new TemplateLoadingException('The template file cache couldn\'t been written due to this problem :' . $ex->getMessage());
     }
 }
 private function get_parsed_content()
 {
     $parser = new TemplateSyntaxParser();
     return $parser->parse($this->content);
 }