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