PKPSubmissionFileDAO::getByBestId PHP Method

getByBestId() public method

Retrieve file by public ID or, failing that, internal file ID and revision; public ID takes precedence.
public getByBestId ( $fileId, $submissionId ) : SubmissionFile | null
$fileId string Either public ID or fileId-revision
$submissionId int
return SubmissionFile | null
    function getByBestId($fileId, $submissionId)
    {
        $file = null;
        if ($fileId != '') {
            $file = $this->getByPubId('publisher-id', $fileId, $submissionId);
        }
        if (!isset($file)) {
            list($fileId, $revision) = array_map(create_function('$a', 'return (int) $a;'), preg_split('/-/', $fileId));
            $file = $this->getRevision($fileId, $revision, null, $submissionId);
        }
        if ($file && $file->getFileStage() == SUBMISSION_FILE_PROOF) {
            return $file;
        }
        if ($file && $file->getFileStage() == SUBMISSION_FILE_DEPENDENT) {
            return $file;
        }
        return null;
    }