original_string: public function findFileByFilenameAndRevision($filename, $revision)
      {
          $filename = (string) $filename;
          $revision = (integer) $revision;
  
          if ($revision < 0) {
              $skip = abs($revision) - 1;
              $sortOrder = -1;
          } else {
              $skip = $revision;
              $sortOrder = 1;
          }
  
          return $this->filesCollection->findOne(
              ['filename' => $filename],
              [
                  'skip' => $skip,
                  'sort' => ['uploadDate' => $sortOrder],
                  'typeMap' => ['root' => 'stdClass'],
              ]
          );
      }
code: public function findFileByFilenameAndRevision($filename, $revision)
      {
          $filename = (string) $filename;
          $revision = (integer) $revision;
  
          if ($revision < 0) {
              $skip = abs($revision) - 1;
              $sortOrder = -1;
          } else {
              $skip = $revision;
              $sortOrder = 1;
          }
  
          return $this->filesCollection->findOne(
              ['filename' => $filename],
              [
                  'skip' => $skip,
                  'sort' => ['uploadDate' => $sortOrder],
                  'typeMap' => ['root' => 'stdClass'],
              ]
          );
      }
code_tokens: public function findFileByFilenameAndRevision ( $ filename , $ revision ) { $ filename = ( string ) $ filename ; $ revision = ( integer ) $ revision ; if ( $ revision < 0 ) { $ skip = abs ( $ revision ) - 1 ; $ sortOrder = - 1 ; } else { $ skip = $ revision ; $ sortOrder = 1 ; } return $ this -> filesCollection -> findOne ( [ 'filename' => $ filename ] , [ 'skip' => $ skip , 'sort' => [ 'uploadDate' => $ sortOrder ] , 'typeMap' => [ 'root' => 'stdClass' ] , ] ) ; }
docstring: Finds a GridFS file document for a given filename and revision.
  
  Revision numbers are defined as follows:
  
  * 0 = the original stored file
  * 1 = the first revision
  * 2 = the second revision
  * etc…
  * -2 = the second most recent revision
  * -1 = the most recent revision
  
  @see Bucket::downloadToStreamByName()
  @see Bucket::openDownloadStreamByName()
  @param string $filename
  @param integer $revision
  @return stdClass|null
docstring_tokens: Finds a GridFS file document for a given filename and revision .