Heystack\Ecommerce\Locale\LocaleService
Class LocaleService
- Author: Cam Spiers <cameron@heyday.co.nz>
Synopsis
class LocaleService
implements
LocaleServiceInterface
{
- // constants
- const ACTIVE_COUNTRY_KEY = 'localservice.activecountry';
- // members
- protected $countries;
- protected CountryInterface $defaultCountry;
- protected CountryInterface $activeCountry;
- protected State $sessionState;
- protected EventDispatcherInterface $eventService;
- // methods
- public void __construct()
- protected void setCountries()
- protected void addCountry()
- public void restoreState()
- public void saveState()
- public void setActiveCountry()
- public CountryInterface getActiveCountry()
- public CountryInterface|null getCountry()
- public array getCountries()
- public bool setDefaultCountry()
- public mixed getDefaultCountry()
- public bool hasCountry()
Hierarchy
Constants
Name | Value |
---|---|
ACTIVE_COUNTRY_KEY | 'localservice.activecountry' |
Members
protected
- $activeCountry — \Heystack\Ecommerce\Locale\Interfaces\CountryInterface
- $countries — array
- $defaultCountry — \Heystack\Ecommerce\Locale\Interfaces\CountryInterface
- $eventService — \Symfony\Component\EventDispatcher\EventDispatcherInterface
- $sessionState — \Heystack\Core\State\State
Methods
protected
public
- __construct()
- getActiveCountry()
- getCountries() — Returns an array of all countries from the cache
- getCountry() — Uses the identifier to retrieve the country object from the cache
- getDefaultCountry()
- hasCountry()
- restoreState() — Uses the State service to retrieve the active country's identifier and sets the active country.
- saveState() — Saves the data array on the State service
- setActiveCountry()
- setDefaultCountry()