DefaultCountryResolver.php in Commerce Core 8.2        
                          
                  
                        
  
  
  
  
  
File
  src/Resolver/DefaultCountryResolver.php
  
    View source  
  <?php
namespace Drupal\commerce\Resolver;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\commerce\Country;
class DefaultCountryResolver implements CountryResolverInterface {
  
  protected $configFactory;
  
  public function __construct(ConfigFactoryInterface $config_factory) {
    $this->configFactory = $config_factory;
  }
  
  public function resolve() {
    $country_code = $this->configFactory
      ->get('system.date')
      ->get('country.default');
    return new Country($country_code);
  }
}