public function __construct($shortName, array $names, $date, $displayLocale = self::DEFAULT_LOCALE, $type = self::TYPE_NATIONAL)
{
// Validate if short name is not empty
if (empty($shortName)) {
throw new InvalidArgumentException('Holiday name can not be blank.');
}
// Validate if date parameter is instance of DateTime
if (!$date instanceof DateTime) {
throw new InvalidArgumentException(sprintf('Date "%s" is not a valid DateTime instance.', $date));
}
// Load internal locales variable
if (!isset(static::$locales)) {
static::$locales = Yasumi::getAvailableLocales();
}
// Assert display locale input
if (!in_array($displayLocale, static::$locales)) {
throw new UnknownLocaleException(sprintf('Locale "%s" is not a valid locale.', $displayLocale));
}
// Set additional attributes
$this->shortName = $shortName;
$this->translations = $names;
$this->displayLocale = $displayLocale;
$this->type = $type;
// Construct instance
parent::__construct($date->format('Y-m-d'), $date->getTimezone());
}