original_string: private function save($key, $data)
      {
          $path = $this->getPath($key);
  
          if (isset($this->locks[$key])) {
              $fp = $this->locks[$key];
              @ftruncate($fp, 0);
              @fseek($fp, 0);
              $len = @fwrite($fp, $data);
              if (\strlen($data) !== $len) {
                  @ftruncate($fp, 0);
  
                  return false;
              }
          } else {
              if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) {
                  return false;
              }
  
              $tmpFile = tempnam(\dirname($path), basename($path));
              if (false === $fp = @fopen($tmpFile, 'wb')) {
                  @unlink($tmpFile);
  
                  return false;
              }
              @fwrite($fp, $data);
              @fclose($fp);
  
              if ($data != file_get_contents($tmpFile)) {
                  @unlink($tmpFile);
  
                  return false;
              }
  
              if (false === @rename($tmpFile, $path)) {
                  @unlink($tmpFile);
  
                  return false;
              }
          }
  
          @chmod($path, 0666 & ~umask());
      }
code: private function save($key, $data)
      {
          $path = $this->getPath($key);
  
          if (isset($this->locks[$key])) {
              $fp = $this->locks[$key];
              @ftruncate($fp, 0);
              @fseek($fp, 0);
              $len = @fwrite($fp, $data);
              if (\strlen($data) !== $len) {
                  @ftruncate($fp, 0);
  
                  return false;
              }
          } else {
              if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) {
                  return false;
              }
  
              $tmpFile = tempnam(\dirname($path), basename($path));
              if (false === $fp = @fopen($tmpFile, 'wb')) {
                  @unlink($tmpFile);
  
                  return false;
              }
              @fwrite($fp, $data);
              @fclose($fp);
  
              if ($data != file_get_contents($tmpFile)) {
                  @unlink($tmpFile);
  
                  return false;
              }
  
              if (false === @rename($tmpFile, $path)) {
                  @unlink($tmpFile);
  
                  return false;
              }
          }
  
          @chmod($path, 0666 & ~umask());
      }
code_tokens: private function save ( $ key , $ data ) { $ path = $ this -> getPath ( $ key ) ; if ( isset ( $ this -> locks [ $ key ] ) ) { $ fp = $ this -> locks [ $ key ] ; @ ftruncate ( $ fp , 0 ) ; @ fseek ( $ fp , 0 ) ; $ len = @ fwrite ( $ fp , $ data ) ; if ( \ strlen ( $ data ) !== $ len ) { @ ftruncate ( $ fp , 0 ) ; return false ; } } else { if ( ! file_exists ( \ dirname ( $ path ) ) && false === @ mkdir ( \ dirname ( $ path ) , 0777 , true ) && ! is_dir ( \ dirname ( $ path ) ) ) { return false ; } $ tmpFile = tempnam ( \ dirname ( $ path ) , basename ( $ path ) ) ; if ( false === $ fp = @ fopen ( $ tmpFile , 'wb' ) ) { @ unlink ( $ tmpFile ) ; return false ; } @ fwrite ( $ fp , $ data ) ; @ fclose ( $ fp ) ; if ( $ data != file_get_contents ( $ tmpFile ) ) { @ unlink ( $ tmpFile ) ; return false ; } if ( false === @ rename ( $ tmpFile , $ path ) ) { @ unlink ( $ tmpFile ) ; return false ; } } @ chmod ( $ path , 0666 & ~ umask ( ) ) ; }
docstring: Save data for the given key.
  
  @param string $key  The store key
  @param string $data The data to store
  
  @return bool
docstring_tokens: Save data for the given key .