src/Composer/Package/Archiver/BaseExcludeFilter.php
public function filter($relativePath, $exclude)
    {
        foreach ($this->excludePatterns as $patternData) {
            list($pattern, $negate, $stripLeadingSlash) = $patternData;

            if ($stripLeadingSlash) {
                $path = substr($relativePath, 1);
            } else {
                $path = $relativePath;
            }

            if (preg_match($pattern, $path)) {
                $exclude = !$negate;
            }
        }

        return $exclude;
    }
public function filter($relativePath, $exclude)
    {
        foreach ($this->excludePatterns as $patternData) {
            list($pattern, $negate, $stripLeadingSlash) = $patternData;

            if ($stripLeadingSlash) {
                $path = substr($relativePath, 1);
            } else {
                $path = $relativePath;
            }

            if (preg_match($pattern, $path)) {
                $exclude = !$negate;
            }
        }

        return $exclude;
    }
Checks the given path against all exclude patterns in this filter

Negated patterns overwrite exclude decisions of previous filters.

@param string $relativePath The file's path relative to the sourcePath
@param bool   $exclude      Whether a previous filter wants to exclude this file

@return bool Whether the file should be excluded