Pricing/Resolver/TaxResolver.php
public function resolveTaxes(TaxableInterface $taxable, $target = null): array
    {
        // TODO @param ContextInterface $context (instead of $target)

        // Abort if taxable does not have tax group
        if (null === $taxGroup = $taxable->getTaxGroup()) {
            return [];
        }

        // Abort if tax group does not have taxes
        if (!$taxGroup->hasTaxes()) {
            return [];
        }

        $country = $this->resolveTargetCountry($target);
        $business = $target instanceof VatNumberSubjectInterface
            ? $target->isBusiness()
            : false;

        // Use cached resolved taxes if any
        if (null !== $taxes = $this->cache->get($taxGroup, $country, $business)) {
            return $taxes;
        }

        // Abort if no matching tax rule
        if (null === $taxRule = $this->resolveTaxRule($country, $business)) {
            return [];
        }

        // Abort if tax rule does not have taxes
        if (!$taxRule->hasTaxes()) {
            return [];
        }

        // Resolves the taxes
        $applicableTaxes = $taxRule->getTaxes()->toArray();
        $resolvedTaxes = [];
        foreach ($taxGroup->getTaxes() as $tax) {
            if (in_array($tax, $applicableTaxes, true)) {
                $resolvedTaxes[] = $tax;
            }
        }

        // Caches the resolved taxes
        $this->cache->set($taxGroup, $country, $business, $resolvedTaxes);

        return $resolvedTaxes;
    }
public function resolveTaxes(TaxableInterface $taxable, $target = null): array
    {
        // TODO @param ContextInterface $context (instead of $target)

        // Abort if taxable does not have tax group
        if (null === $taxGroup = $taxable->getTaxGroup()) {
            return [];
        }

        // Abort if tax group does not have taxes
        if (!$taxGroup->hasTaxes()) {
            return [];
        }

        $country = $this->resolveTargetCountry($target);
        $business = $target instanceof VatNumberSubjectInterface
            ? $target->isBusiness()
            : false;

        // Use cached resolved taxes if any
        if (null !== $taxes = $this->cache->get($taxGroup, $country, $business)) {
            return $taxes;
        }

        // Abort if no matching tax rule
        if (null === $taxRule = $this->resolveTaxRule($country, $business)) {
            return [];
        }

        // Abort if tax rule does not have taxes
        if (!$taxRule->hasTaxes()) {
            return [];
        }

        // Resolves the taxes
        $applicableTaxes = $taxRule->getTaxes()->toArray();
        $resolvedTaxes = [];
        foreach ($taxGroup->getTaxes() as $tax) {
            if (in_array($tax, $applicableTaxes, true)) {
                $resolvedTaxes[] = $tax;
            }
        }

        // Caches the resolved taxes
        $this->cache->set($taxGroup, $country, $business, $resolvedTaxes);

        return $resolvedTaxes;
    }
public function resolveTaxes ( TaxableInterface $ taxable , $ target = null ) : array { // TODO @param ContextInterface $context (instead of $target) // Abort if taxable does not have tax group if ( null === $ taxGroup = $ taxable -> getTaxGroup ( ) ) { return [ ] ; } // Abort if tax group does not have taxes if ( ! $ taxGroup -> hasTaxes ( ) ) { return [ ] ; } $ country = $ this -> resolveTargetCountry ( $ target ) ; $ business = $ target instanceof VatNumberSubjectInterface ? $ target -> isBusiness ( ) : false ; // Use cached resolved taxes if any if ( null !== $ taxes = $ this -> cache -> get ( $ taxGroup , $ country , $ business ) ) { return $ taxes ; } // Abort if no matching tax rule if ( null === $ taxRule = $ this -> resolveTaxRule ( $ country , $ business ) ) { return [ ] ; } // Abort if tax rule does not have taxes if ( ! $ taxRule -> hasTaxes ( ) ) { return [ ] ; } // Resolves the taxes $ applicableTaxes = $ taxRule -> getTaxes ( ) -> toArray ( ) ; $ resolvedTaxes = [ ] ; foreach ( $ taxGroup -> getTaxes ( ) as $ tax ) { if ( in_array ( $ tax , $ applicableTaxes , true ) ) { $ resolvedTaxes [ ] = $ tax ; } } // Caches the resolved taxes $ this -> cache -> set ( $ taxGroup , $ country , $ business , $ resolvedTaxes ) ; return $ resolvedTaxes ; }
@inheritdoc

@see https://ec.europa.eu/taxation_customs/business/vat/eu-vat-rules-topic/where-tax_fr
@inheritdoc