original_string: public function lock(Request $request)
      {
          $key = $this->getCacheKey($request);
  
          if (!isset($this->locks[$key])) {
              $path = $this->getPath($key);
              if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) {
                  return $path;
              }
              $h = fopen($path, 'cb');
              if (!flock($h, LOCK_EX | LOCK_NB)) {
                  fclose($h);
  
                  return $path;
              }
  
              $this->locks[$key] = $h;
          }
  
          return true;
      }
code: public function lock(Request $request)
      {
          $key = $this->getCacheKey($request);
  
          if (!isset($this->locks[$key])) {
              $path = $this->getPath($key);
              if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) {
                  return $path;
              }
              $h = fopen($path, 'cb');
              if (!flock($h, LOCK_EX | LOCK_NB)) {
                  fclose($h);
  
                  return $path;
              }
  
              $this->locks[$key] = $h;
          }
  
          return true;
      }
code_tokens: public function lock ( Request $ request ) { $ key = $ this -> getCacheKey ( $ request ) ; if ( ! isset ( $ this -> locks [ $ key ] ) ) { $ path = $ this -> getPath ( $ key ) ; if ( ! file_exists ( \ dirname ( $ path ) ) && false === @ mkdir ( \ dirname ( $ path ) , 0777 , true ) && ! is_dir ( \ dirname ( $ path ) ) ) { return $ path ; } $ h = fopen ( $ path , 'cb' ) ; if ( ! flock ( $ h , LOCK_EX | LOCK_NB ) ) { fclose ( $ h ) ; return $ path ; } $ this -> locks [ $ key ] = $ h ; } return true ; }
docstring: Tries to lock the cache for a given Request, without blocking.
  
  @return bool|string true if the lock is acquired, the path to the current lock otherwise
docstring_tokens: Tries to lock the cache for a given Request without blocking .