class DefaultCountryResolver in Price 2.0.x
Same name and namespace in other branches
- 8 src/Resolver/DefaultCountryResolver.php \Drupal\price\Resolver\DefaultCountryResolver
- 3.x src/Resolver/DefaultCountryResolver.php \Drupal\price\Resolver\DefaultCountryResolver
- 2.x src/Resolver/DefaultCountryResolver.php \Drupal\price\Resolver\DefaultCountryResolver
- 3.0.x src/Resolver/DefaultCountryResolver.php \Drupal\price\Resolver\DefaultCountryResolver
Returns the site's default country.
Hierarchy
- class \Drupal\price\Resolver\DefaultCountryResolver implements CountryResolverInterface
Expanded class hierarchy of DefaultCountryResolver
1 string reference to 'DefaultCountryResolver'
1 service uses DefaultCountryResolver
File
- src/
Resolver/ DefaultCountryResolver.php, line 11
Namespace
Drupal\price\ResolverView source
class DefaultCountryResolver implements CountryResolverInterface {
/**
* The configuration factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs a new DefaultCountryResolver object.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
}
/**
* {@inheritdoc}
*/
public function resolve() {
$country_code = $this->configFactory
->get('system.date')
->get('country.default');
return new Country($country_code);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DefaultCountryResolver:: |
protected | property | The configuration factory. | |
DefaultCountryResolver:: |
public | function |
Resolves the country. Overrides CountryResolverInterface:: |
|
DefaultCountryResolver:: |
public | function | Constructs a new DefaultCountryResolver object. |