public function compareArchive(array $unexpectedArtifacts)
    {
        $foundUnexpectedArtifacts = [];
        $archive = new PharData($this->getFilename());
        $hasLicenseFile = false;

        foreach ($archive as $archiveFile) {
            if ($archiveFile instanceof \SplFileInfo) {
                if ($archiveFile->isDir()) {
                    $file = basename($archiveFile) . '/';
                    if (in_array($file, $unexpectedArtifacts)) {
                        $foundUnexpectedArtifacts[] = $file;
                    }
                    continue;
                }

                $file = basename($archiveFile);
                if ($this->validateLicenseFilePresence()) {
                    if (preg_match('/(License.*)/i', $file)) {
                        $hasLicenseFile = true;
                    }
                }

                if (in_array($file, $unexpectedArtifacts)) {
                    $foundUnexpectedArtifacts[] = $file;
                }
            }
        }

        if ($this->validateLicenseFilePresence() && $hasLicenseFile === false) {
            throw new NoLicenseFilePresent('No license file present in archive.');
        }

        sort($foundUnexpectedArtifacts, SORT_STRING | SORT_FLAG_CASE);

        return $foundUnexpectedArtifacts;
    }