CommerceGuys\Tax\Resolver\TaxType\EuTaxTypeResolver::filterByAddress PHP Method

filterByAddress() protected method

Filters out tax types not matching the provided address.
protected filterByAddress ( array $taxTypes, CommerceGuys\Addressing\AddressInterface $address ) : CommerceGuys\Tax\Model\TaxTypeInterface[]
$taxTypes array The tax types to filter.
$address CommerceGuys\Addressing\AddressInterface The address to filter by.
return CommerceGuys\Tax\Model\TaxTypeInterface[] An array of tax types whose zones match the provided address.
    protected function filterByAddress(array $taxTypes, AddressInterface $address)
    {
        $taxTypes = array_filter($taxTypes, function ($taxType) use($address) {
            $zone = $taxType->getZone();
            return $zone->match($address);
        });
        return $taxTypes;
    }