DefaultCountryResolver.php in Price 2.0.x
Same filename and directory in other branches
Namespace
Drupal\price\ResolverFile
src/Resolver/DefaultCountryResolver.phpView source
<?php
namespace Drupal\price\Resolver;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\price\Country;
/**
* Returns the site's default country.
*/
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);
}
}
Classes
Name![]() |
Description |
---|---|
DefaultCountryResolver | Returns the site's default country. |