/** * @param \Heystack\Ecommerce\Locale\Interfaces\CountryInterface $country * @return \Heystack\Ecommerce\Locale\Interfaces\ZoneInterface * @throws \InvalidArgumentException */ public function getZoneForCountry(CountryInterface $country) { $identifier = $country->getIdentifier(); foreach ($this->zones as $zone) { if ($zone->hasCountry($identifier)) { return $zone; } } throw new \InvalidArgumentException(sprintf("No zone exists for country '%s'", $identifier->getFull())); }
/** * @param \Heystack\Ecommerce\Locale\Interfaces\CountryInterface $country * @return void */ protected function addCountry(CountryInterface $country) { $this->countries[$country->getIdentifier()->getFull()] = $country; }