CountryService

This service class contains methods related to countries.
All public functions are available in the Twig template renderer.

Namespace

IO\Services

Properties
Type Name Description

CountryRepositoryContract

$countryRepository

Repository used for manipulating country data

array

$activeCountries

Active countries

Methods
public __construct($countryRepository)

CountryService constructor.

Parameters

Type

Name

Description

CountryRepositoryContract

$countryRepository

Repository used for manipulating country data

public getActiveCountriesList($lang = null):array

List all active countries

Parameters

Type

Name

Description

string

$lang

Optional: Language for country names

public getActiveCountryNameMap($language):array

Get a list of names for the active countries

Parameters

Type

Name

Description

string

$language

Language of names

public getShippingCountryId():int

Get the id of the current shipping country

public setShippingCountryId($shippingCountryId)

Set the id of the current shipping country

Parameters

Type

Name

Description

int

$shippingCountryId

Id of shippingCountry

public getCountryById($countryId):Country

Get a specific Country model by id

Parameters

Type

Name

Description

int

$countryId

Id of country

public getCountryName($countryId, $lang = null):string

Get the name of specific country

Parameters

Type

Name

Description

int

$countryId

Id of country to get name from

string

$lang

Optional: Language for country name