original_string: public function cache($file, $content, $timestamp = null)
      {
          if (!$cachePath = $this->cachePath()) {
              throw new JitException('Error, any cache path has been defined.');
          }
          $path = $cachePath . DS . ltrim(preg_replace('~:~', '', $file), DS);
  
          if (!@file_exists(dirname($path))) {
              mkdir(dirname($path), 0755, true);
          }
  
          if (file_put_contents($path, $content) === false) {
              throw new JitException("Unable to create a cached file at `'{$file}'`.");
          }
          if ($timestamp) {
              touch($path, $timestamp);
          }
          return $path;
      }
code: public function cache($file, $content, $timestamp = null)
      {
          if (!$cachePath = $this->cachePath()) {
              throw new JitException('Error, any cache path has been defined.');
          }
          $path = $cachePath . DS . ltrim(preg_replace('~:~', '', $file), DS);
  
          if (!@file_exists(dirname($path))) {
              mkdir(dirname($path), 0755, true);
          }
  
          if (file_put_contents($path, $content) === false) {
              throw new JitException("Unable to create a cached file at `'{$file}'`.");
          }
          if ($timestamp) {
              touch($path, $timestamp);
          }
          return $path;
      }
code_tokens: public function cache ( $ file , $ content , $ timestamp = null ) { if ( ! $ cachePath = $ this -> cachePath ( ) ) { throw new JitException ( 'Error, any cache path has been defined.' ) ; } $ path = $ cachePath . DS . ltrim ( preg_replace ( '~:~' , '' , $ file ) , DS ) ; if ( ! @ file_exists ( dirname ( $ path ) ) ) { mkdir ( dirname ( $ path ) , 0755 , true ) ; } if ( file_put_contents ( $ path , $ content ) === false ) { throw new JitException ( "Unable to create a cached file at `'{$file}'`." ) ; } if ( $ timestamp ) { touch ( $ path , $ timestamp ) ; } return $ path ; }
docstring: Cache helper.
  
  @param  string $file    The source file path.
  @param  string $content The patched content to cache.
  @return string          The patched file path or the cache path if called with no params.
docstring_tokens: Cache helper .