CommerceGuys\Tax\Resolver\TaxType\StoreRegistrationCheckerTrait::filterByStoreRegistration PHP Method

filterByStoreRegistration() protected method

Filters out tax types not matching the store registration.
protected filterByStoreRegistration ( array $taxTypes, Context $context ) : CommerceGuys\Tax\Model\TaxTypeInterface[]
$taxTypes array The tax types to filter.
$context CommerceGuys\Tax\Resolver\Context The context containing store information.
return CommerceGuys\Tax\Model\TaxTypeInterface[] An array of additional tax types the store is registered to collect.
    protected function filterByStoreRegistration(array $taxTypes, Context $context)
    {
        $taxTypes = array_filter($taxTypes, function ($taxType) use($context) {
            $zone = $taxType->getZone();
            return $this->checkStoreRegistration($zone, $context);
        });
        return $taxTypes;
    }