protected function collectSubpackagePatches(array $subPackages, $allowedSubpatches)
    {
        $collectedPatches = new PatchCollection();
        if ($allowedSubpatches !== false && $allowedSubpatches !== array()) {
            foreach ($subPackages as $subPackage) {
                if ($allowedSubpatches === true || in_array($subPackage->getName(), $allowedSubpatches, true)) {
                    $collectedPatches->merge($this->collectPatchesFromPackage($subPackage));
                }
            }
        }

        return $collectedPatches;
    }