original_string: private function createPathForFile(stdClass $file)
      {
          if ( ! is_object($file->_id) || method_exists($file->_id, '__toString')) {
              $id = (string) $file->_id;
          } else {
              $id = \MongoDB\BSON\toJSON(\MongoDB\BSON\fromPHP(['_id' => $file->_id]));
          }
  
          return sprintf(
              '%s://%s/%s.files/%s',
              self::$streamWrapperProtocol,
              urlencode($this->databaseName),
              urlencode($this->bucketName),
              urlencode($id)
          );
      }
code: private function createPathForFile(stdClass $file)
      {
          if ( ! is_object($file->_id) || method_exists($file->_id, '__toString')) {
              $id = (string) $file->_id;
          } else {
              $id = \MongoDB\BSON\toJSON(\MongoDB\BSON\fromPHP(['_id' => $file->_id]));
          }
  
          return sprintf(
              '%s://%s/%s.files/%s',
              self::$streamWrapperProtocol,
              urlencode($this->databaseName),
              urlencode($this->bucketName),
              urlencode($id)
          );
      }
code_tokens: private function createPathForFile ( stdClass $ file ) { if ( ! is_object ( $ file -> _id ) || method_exists ( $ file -> _id , '__toString' ) ) { $ id = ( string ) $ file -> _id ; } else { $ id = \ MongoDB \ BSON \ toJSON ( \ MongoDB \ BSON \ fromPHP ( [ '_id' => $ file -> _id ] ) ) ; } return sprintf ( '%s://%s/%s.files/%s' , self :: $ streamWrapperProtocol , urlencode ( $ this -> databaseName ) , urlencode ( $ this -> bucketName ) , urlencode ( $ id ) ) ; }
docstring: Creates a path for an existing GridFS file.
  
  @param stdClass $file GridFS file document
  @return string
docstring_tokens: Creates a path for an existing GridFS file .