Problem/Motivation

I have a review for the methods in CountryManager, it seems those methods actually are storage functions:
getList
getAvailableList
getEnabledList
getZoneList
getByProperty

Proposed resolution

Rename CountryManager into CountryStorage and extend from ConfigEntityStorage:

class CountryStorage extends ConfigEntityStorage implements CountryStorageInterface

Add changed the implementations of it's functions.

Comments

jian he created an issue. See original summary.

TR’s picture

Status: Active » Closed (won't fix)

Core Drupal provides the country_manager service - see core/core.services.yml
Core Drupal defines the default implementation of this service in Drupal\Core\Locale\CountryManager
The core Drupal country_manager service only maintains the alpha_2 code and country name, and makes these available only through the getList() method

Ubercart needs more country information than core can provide, so Ubercart overrides and extends the core country_manager service to provide additional country information - alpha_3 and numeric codes as well as zone codes, zone names , and address format for all the countries.

So you see, CountryManager gets its name because it overrides core CountryManager and because it implements the core country_manager service. It would be confusing for us to call it something different, even if a different name describes it better.