class ChainTaxRateResolver in Commerce Core 8.2
Hierarchy
- class \Drupal\commerce_tax\Resolver\ChainTaxRateResolver implements ChainTaxRateResolverInterface uses TaxTypeAwareTrait
Expanded class hierarchy of ChainTaxRateResolver
1 string reference to 'ChainTaxRateResolver'
- commerce_tax.services.yml in modules/
tax/ commerce_tax.services.yml - modules/tax/commerce_tax.services.yml
1 service uses ChainTaxRateResolver
File
- modules/
tax/ src/ Resolver/ ChainTaxRateResolver.php, line 9
Namespace
Drupal\commerce_tax\ResolverView source
class ChainTaxRateResolver implements ChainTaxRateResolverInterface {
use TaxTypeAwareTrait;
/**
* The resolvers.
*
* @var \Drupal\commerce_tax\Resolver\TaxRateResolverInterface[]
*/
protected $resolvers = [];
/**
* Constructs a new ChainTaxRateResolver object.
*
* @param \Drupal\commerce_tax\Resolver\TaxRateResolverInterface[] $resolvers
* The resolvers.
*/
public function __construct(array $resolvers = []) {
$this->resolvers = $resolvers;
}
/**
* {@inheritdoc}
*/
public function addResolver(TaxRateResolverInterface $resolver) {
$this->resolvers[] = $resolver;
}
/**
* {@inheritdoc}
*/
public function getResolvers() {
return $this->resolvers;
}
/**
* {@inheritdoc}
*/
public function resolve(TaxZone $zone, OrderItemInterface $order_item, ProfileInterface $customer_profile) {
$result = NULL;
foreach ($this->resolvers as $resolver) {
if ($resolver instanceof TaxTypeAwareInterface) {
$resolver
->setTaxType($this->taxType);
}
$result = $resolver
->resolve($zone, $order_item, $customer_profile);
if ($result) {
break;
}
}
return $result;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ChainTaxRateResolver:: |
protected | property | The resolvers. | |
ChainTaxRateResolver:: |
public | function |
Adds a resolver. Overrides ChainTaxRateResolverInterface:: |
|
ChainTaxRateResolver:: |
public | function |
Gets all added resolvers. Overrides ChainTaxRateResolverInterface:: |
|
ChainTaxRateResolver:: |
public | function |
Resolves the tax rate for the given tax zone. Overrides TaxRateResolverInterface:: |
|
ChainTaxRateResolver:: |
public | function | Constructs a new ChainTaxRateResolver object. | |
TaxRateResolverInterface:: |
constant | |||
TaxTypeAwareTrait:: |
protected | property | The tax type. | |
TaxTypeAwareTrait:: |
public | function |