/** * {@inheritdoc} */ public function createCollection(array $data = array()) { $collection = new Timezones(); foreach ($data as $foobar_data) { foreach ($foobar_data as $iso_3166_1 => $timezones) { $country = new Timezone\CountryTimezone(); $country->setIso31661($iso_3166_1); foreach ($timezones as $timezone) { $country->getTimezones()->add(null, $timezone); } $collection->add(null, $country); } } return $collection; }
/** * Verify if a country supports a certain timezone * * @param $timezone * @return mixed */ public function supports($timezone) { return false !== $this->timezones->hasValue($timezone); }