original_string: private function writeFile($fileName, $value)
      {
          $dirName = $this->buildDirectoryForFilename($fileName);
  
          $this->log(
              Mustache_Logger::DEBUG,
              'Caching compiled template to "{fileName}"',
              array('fileName' => $fileName)
          );
  
          $tempFile = tempnam($dirName, basename($fileName));
          if (false !== @file_put_contents($tempFile, $value)) {
              if (@rename($tempFile, $fileName)) {
                  $mode = isset($this->fileMode) ? $this->fileMode : (0666 & ~umask());
                  @chmod($fileName, $mode);
  
                  return;
              }
  
              // @codeCoverageIgnoreStart
              $this->log(
                  Mustache_Logger::ERROR,
                  'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"',
                  array('tempName' => $tempFile, 'fileName' => $fileName)
              );
              // @codeCoverageIgnoreEnd
          }
  
          // @codeCoverageIgnoreStart
          throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName));
          // @codeCoverageIgnoreEnd
      }
code: private function writeFile($fileName, $value)
      {
          $dirName = $this->buildDirectoryForFilename($fileName);
  
          $this->log(
              Mustache_Logger::DEBUG,
              'Caching compiled template to "{fileName}"',
              array('fileName' => $fileName)
          );
  
          $tempFile = tempnam($dirName, basename($fileName));
          if (false !== @file_put_contents($tempFile, $value)) {
              if (@rename($tempFile, $fileName)) {
                  $mode = isset($this->fileMode) ? $this->fileMode : (0666 & ~umask());
                  @chmod($fileName, $mode);
  
                  return;
              }
  
              // @codeCoverageIgnoreStart
              $this->log(
                  Mustache_Logger::ERROR,
                  'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"',
                  array('tempName' => $tempFile, 'fileName' => $fileName)
              );
              // @codeCoverageIgnoreEnd
          }
  
          // @codeCoverageIgnoreStart
          throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName));
          // @codeCoverageIgnoreEnd
      }
code_tokens: private function writeFile ( $ fileName , $ value ) { $ dirName = $ this -> buildDirectoryForFilename ( $ fileName ) ; $ this -> log ( Mustache_Logger :: DEBUG , 'Caching compiled template to "{fileName}"' , array ( 'fileName' => $ fileName ) ) ; $ tempFile = tempnam ( $ dirName , basename ( $ fileName ) ) ; if ( false !== @ file_put_contents ( $ tempFile , $ value ) ) { if ( @ rename ( $ tempFile , $ fileName ) ) { $ mode = isset ( $ this -> fileMode ) ? $ this -> fileMode : ( 0666 & ~ umask ( ) ) ; @ chmod ( $ fileName , $ mode ) ; return ; } // @codeCoverageIgnoreStart $ this -> log ( Mustache_Logger :: ERROR , 'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"' , array ( 'tempName' => $ tempFile , 'fileName' => $ fileName ) ) ; // @codeCoverageIgnoreEnd } // @codeCoverageIgnoreStart throw new Mustache_Exception_RuntimeException ( sprintf ( 'Failed to write cache file "%s".' , $ fileName ) ) ; // @codeCoverageIgnoreEnd }
docstring: Write cache file.
  
  @throws Mustache_Exception_RuntimeException If unable to write file
  
  @param string $fileName
  @param string $value
docstring_tokens: Write cache file .