Class CountryService

Class CountryService

This class is used for finding country data

CountryService implements CountryServiceInterface
Package: Customer\Country
Category: System
Implements: CountryServiceInterface
Located at Services/Core/Country/CountryService.inc.php

Methods summary

public __construct( CustomerCountryRepositoryInterface $customerCountryRepo, CustomerCountryZoneRepositoryInterface $customerCountryZoneRepo )

Constructor of the class CountryService

public getCountryById( IdType $id ) : CustomerCountryInterface

Getter method for the country ID

public getCountryZoneByNameAndCountry( CustomerCountryZoneNameInterface|string $p_zoneName, CustomerCountryInterface $customerCountry ) : CustomerCountryZoneInterface

Getter method for the country zone

public findCountryZoneByNameAndCountry( CustomerCountryZoneNameInterface|string $p_zoneName, CustomerCountryInterface $customerCountry ) : CustomerCountryZoneInterface|null

This method returns a CustomerCountryZone object if found. Otherwise null will be returned.

public getUnknownCountryZoneByName( string $p_zoneName ) : CustomerCountryZone

This method will return a new CustomerCountryZone object representing an unknown country zone.

public findCountryZonesByCountryId( IdType $countryId ) : array

This method will return an array of CustomerCountryZone objects found by the country ID. If the country has no zones, an empty array will be returned

public countryZoneExistsInCountry( CustomerCountryZoneInterface $customerCountryZone, CustomerCountryInterface $customerCountry ) : boolean

Checks if there is a country zone in a country

public countryHasCountryZones( CustomerCountryInterface $customerCountry ) : boolean

Checks if country has country zones

public getCountryByName( string $p_countryName ) : CustomerCountryInterface

Get country by name.

public findCountryByName( string $p_countryName ) : CustomerCountryInterface

Find country by name.

public getCountryByIso2( string $p_countryIso2 ) : CustomerCountryInterface

Get country by iso2 code.

public findCountryByIso2( string $p_countryIso2 ) : CustomerCountryInterface|null

Find country by iso2 code.

public isStateMandatory( IdType $countryId ) : boolean

This method returns whether the specified country, necessary, needs a state.

public getCountryZoneByZoneCodeAndCountry( CustomerCountryZoneIsoCode $zoneCode, CustomerCountryInterface $country ) : CustomerCountryZoneInterface

Returns the country zone by the given zone code and country. An error will be raised if no results are found.

public getCountryZoneByZoneCodeAndCountryId( CustomerCountryZoneIsoCode $zoneCode, IdType $countryId ) : CustomerCountryZoneInterface

Returns the country zone by the given zone code and country id. An error will be raised if no results are found.

public findCountryZoneByZoneCodeAndCountry( CustomerCountryZoneIsoCode $zoneCode, CustomerCountryInterface $country ) : CustomerCountryZoneInterface|null

Finds the country zone by the given zone code and country. Null will be returned if no results are found.

public findCountryZoneByZoneCodeAndCountryId( CustomerCountryZoneIsoCode $zoneCode, IdType $countryId ) : CustomerCountryZoneInterface

Returns the country zone by the given zone code and country id. Null will be returned if no results are found.

Properties summary