} public function getDecorated(): PackageFilter
{ throw new DecorationPatternException(self::
class);
} public function filterPackages(DiscountLineItem
$discount, DiscountPackageCollection
$packages, int
$originalPackageCount): DiscountPackageCollection
{ $sorterKey =
$discount->
getFilterSorterKey();
$applierKey =
$discount->
getFilterApplierKey();
$countKey =
$discount->
getFilterUsageKey();
$filteredPackages =
[];
if (!
$this->
hasFilterSettings($sorterKey,
$applierKey,
$countKey)) { return new DiscountPackageCollection($packages);
} // now sort each found package depending on our configured sorter
$sortedPackages =
$this->registry->
getSorter($sorterKey)->
sort($packages);