class ChainStoreResolver in Commerce Core 8.2
Default implementation of the chain store resolver.
Hierarchy
- class \Drupal\commerce_store\Resolver\ChainStoreResolver implements ChainStoreResolverInterface
Expanded class hierarchy of ChainStoreResolver
1 file declares its use of ChainStoreResolver
- ChainStoreResolverTest.php in modules/
store/ tests/ src/ Unit/ Resolver/ ChainStoreResolverTest.php
1 string reference to 'ChainStoreResolver'
- commerce_store.services.yml in modules/
store/ commerce_store.services.yml - modules/store/commerce_store.services.yml
1 service uses ChainStoreResolver
File
- modules/
store/ src/ Resolver/ ChainStoreResolver.php, line 8
Namespace
Drupal\commerce_store\ResolverView source
class ChainStoreResolver implements ChainStoreResolverInterface {
/**
* The resolvers.
*
* @var \Drupal\commerce_store\Resolver\StoreResolverInterface[]
*/
protected $resolvers = [];
/**
* Constructs a new ChainStoreResolver object.
*
* @param \Drupal\commerce_store\Resolver\StoreResolverInterface[] $resolvers
* The resolvers.
*/
public function __construct(array $resolvers = []) {
$this->resolvers = $resolvers;
}
/**
* {@inheritdoc}
*/
public function addResolver(StoreResolverInterface $resolver) {
$this->resolvers[] = $resolver;
}
/**
* {@inheritdoc}
*/
public function getResolvers() {
return $this->resolvers;
}
/**
* {@inheritdoc}
*/
public function resolve() {
foreach ($this->resolvers as $resolver) {
$result = $resolver
->resolve();
if ($result) {
return $result;
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ChainStoreResolver:: |
protected | property | The resolvers. | |
ChainStoreResolver:: |
public | function |
Adds a resolver. Overrides ChainStoreResolverInterface:: |
|
ChainStoreResolver:: |
public | function |
Gets all added resolvers. Overrides ChainStoreResolverInterface:: |
|
ChainStoreResolver:: |
public | function |
Resolves the store. Overrides StoreResolverInterface:: |
|
ChainStoreResolver:: |
public | function | Constructs a new ChainStoreResolver object. |