class ChainOrderTypeResolver in Commerce Core 8.2
Default implementation of the chain order type resolver.
Hierarchy
- class \Drupal\commerce_order\Resolver\ChainOrderTypeResolver implements ChainOrderTypeResolverInterface
Expanded class hierarchy of ChainOrderTypeResolver
1 string reference to 'ChainOrderTypeResolver'
- commerce_order.services.yml in modules/
order/ commerce_order.services.yml - modules/order/commerce_order.services.yml
1 service uses ChainOrderTypeResolver
File
- modules/
order/ src/ Resolver/ ChainOrderTypeResolver.php, line 10
Namespace
Drupal\commerce_order\ResolverView source
class ChainOrderTypeResolver implements ChainOrderTypeResolverInterface {
/**
* The resolvers.
*
* @var \Drupal\commerce_order\Resolver\OrderTypeResolverInterface[]
*/
protected $resolvers = [];
/**
* Constructs a new ChainOrderTypeResolver object.
*
* @param \Drupal\commerce_order\Resolver\OrderTypeResolverInterface[] $resolvers
* The resolvers.
*/
public function __construct(array $resolvers = []) {
$this->resolvers = $resolvers;
}
/**
* {@inheritdoc}
*/
public function addResolver(OrderTypeResolverInterface $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 |
---|---|---|---|---|
ChainOrderTypeResolver:: |
protected | property | The resolvers. | |
ChainOrderTypeResolver:: |
public | function |
Adds a resolver. Overrides ChainOrderTypeResolverInterface:: |
|
ChainOrderTypeResolver:: |
public | function |
Gets all added resolvers. Overrides ChainOrderTypeResolverInterface:: |
|
ChainOrderTypeResolver:: |
public | function |
Resolves the order type. Overrides OrderTypeResolverInterface:: |
|
ChainOrderTypeResolver:: |
public | function | Constructs a new ChainOrderTypeResolver object. |