class ChainTaxCodeResolver in Drupal Commerce Connector for AvaTax 8
Provides the chain tax code resolver.
Hierarchy
- class \Drupal\commerce_avatax\Resolver\ChainTaxCodeResolver implements ChainTaxCodeResolverInterface
Expanded class hierarchy of ChainTaxCodeResolver
1 string reference to 'ChainTaxCodeResolver'
1 service uses ChainTaxCodeResolver
File
- src/
Resolver/ ChainTaxCodeResolver.php, line 10
Namespace
Drupal\commerce_avatax\ResolverView source
class ChainTaxCodeResolver implements ChainTaxCodeResolverInterface {
/**
* The tax code resolvers.
*
* @var \Drupal\commerce_avatax\Resolver\TaxCodeResolverInterface[]
*/
protected $resolvers;
/**
* Constructs a new ChainTaxCodeResolver object.
*
* @param \Drupal\commerce_avatax\Resolver\TaxCodeResolverInterface[] $resolvers
* The tax code resolvers.
*/
public function __construct(array $resolvers = []) {
$this->resolvers = $resolvers;
}
/**
* {@inheritdoc}
*/
public function addResolver(TaxCodeResolverInterface $resolver) {
$this->resolvers[] = $resolver;
}
/**
* {@inheritdoc}
*/
public function getResolvers() {
return $this->resolvers;
}
/**
* {@inheritdoc}
*/
public function resolve(OrderItemInterface $order_item) {
foreach ($this->resolvers as $resolver) {
$result = $resolver
->resolve($order_item);
if ($result) {
return $result;
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ChainTaxCodeResolver:: |
protected | property | The tax code resolvers. | |
ChainTaxCodeResolver:: |
public | function |
Adds a resolver. Overrides ChainTaxCodeResolverInterface:: |
|
ChainTaxCodeResolver:: |
public | function |
Gets all added resolvers. Overrides ChainTaxCodeResolverInterface:: |
|
ChainTaxCodeResolver:: |
public | function |
Resolves the tax code of a given order item.. Overrides TaxCodeResolverInterface:: |
|
ChainTaxCodeResolver:: |
public | function | Constructs a new ChainTaxCodeResolver object. |