public static function createTimeZone($timezone = null)
{
if ($timezone instanceof \DateTimeZone) {
return $timezone;
}
if ($timezone === null) {
return new \DateTimeZone(date_default_timezone_get());
}
if (is_string($timezone)) {
return new \DateTimeZone($timezone);
}
throw new \InvalidArgumentException('timezone is not valid');
}