ChainCheckoutFlowResolver.php in Commerce Core 8.2
File
modules/checkout/src/Resolver/ChainCheckoutFlowResolver.php
View source
<?php
namespace Drupal\commerce_checkout\Resolver;
use Drupal\commerce_checkout\Entity\CheckoutFlowInterface;
use Drupal\commerce_order\Entity\OrderInterface;
class ChainCheckoutFlowResolver implements ChainCheckoutFlowResolverInterface {
protected $resolvers = [];
public function __construct(array $resolvers = []) {
$this->resolvers = $resolvers;
}
public function addResolver(CheckoutFlowResolverInterface $resolver) {
$this->resolvers[] = $resolver;
}
public function getResolvers() {
return $this->resolvers;
}
public function resolve(OrderInterface $order) {
foreach ($this->resolvers as $resolver) {
$result = $resolver
->resolve($order);
if ($result instanceof CheckoutFlowInterface) {
return $result;
}
}
return NULL;
}
}