class ChainLocaleResolver in Price 3.x
Same name and namespace in other branches
- 8 src/Resolver/ChainLocaleResolver.php \Drupal\price\Resolver\ChainLocaleResolver
- 2.0.x src/Resolver/ChainLocaleResolver.php \Drupal\price\Resolver\ChainLocaleResolver
- 2.x src/Resolver/ChainLocaleResolver.php \Drupal\price\Resolver\ChainLocaleResolver
- 3.0.x src/Resolver/ChainLocaleResolver.php \Drupal\price\Resolver\ChainLocaleResolver
Default implementation of the chain locale resolver.
Hierarchy
- class \Drupal\price\Resolver\ChainLocaleResolver implements ChainLocaleResolverInterface
Expanded class hierarchy of ChainLocaleResolver
1 string reference to 'ChainLocaleResolver'
1 service uses ChainLocaleResolver
File
- src/
Resolver/ ChainLocaleResolver.php, line 8
Namespace
Drupal\price\ResolverView source
class ChainLocaleResolver implements ChainLocaleResolverInterface {
/**
* The resolvers.
*
* @var \Drupal\price\Resolver\LocaleResolverInterface[]
*/
protected $resolvers = [];
/**
* Constructs a new ChainLocaleResolver object.
*
* @param \Drupal\price\Resolver\LocaleResolverInterface[] $resolvers
* The resolvers.
*/
public function __construct(array $resolvers = []) {
$this->resolvers = $resolvers;
}
/**
* {@inheritdoc}
*/
public function addResolver(LocaleResolverInterface $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 |
---|---|---|---|---|
ChainLocaleResolver:: |
protected | property | The resolvers. | |
ChainLocaleResolver:: |
public | function |
Adds a resolver. Overrides ChainLocaleResolverInterface:: |
|
ChainLocaleResolver:: |
public | function |
Gets all added resolvers. Overrides ChainLocaleResolverInterface:: |
|
ChainLocaleResolver:: |
public | function |
Resolves the locale. Overrides LocaleResolverInterface:: |
|
ChainLocaleResolver:: |
public | function | Constructs a new ChainLocaleResolver object. |