Check if given input is timezone.

@param $key
@return bool
198625
protected function validTimezone($key) : bool
    {
        try {
            new \DateTimeZone($this->param[$key]);
        } catch (\Exception $e) {
            $this->errors[$key.self::ERROR] = $this->convertToFieldName($key).' must be a valid timezone.';
            return false;
        }

        return true;
    }
296095
protected function isDate($key) : bool
    {
        $value = $this->param[$key];
        if (isset($value) && $value instanceof \DateTime) {
            return true;
        }

        $date = date_parse($value);

        if ((!is_string($value) && !is_numeric($value)) || strtotime($value) === false) {
            $this->errors[$key.self::ERROR] = $this->convertToFieldName($key).' must be a valid date.';
            return false;
        } elseif (checkdate($date['month'], $date['day'], $date['year'])) {
            return true;
        }


        $this->errors[$key.self::ERROR] = $this->convertToFieldName($key).' must be a valid date.';
        return false;
    }
76553
public function __isset($key)
    {
        $getter = 'get' . str_replace('_', '', $key);

        return method_exists($this, $getter) && null !== $this->__get($key);
    }
786901
public function do_exists($key)
    {
        $context = $this->_context;

        return isset($context->data[$key]) && $context->data[$key]['deadline'] >= time();
    }
615281
def ensure_timezone(dt, tz=None):
    
    if dt.tzinfo is None:
        return dt.replace(tzinfo=tz or tzlocal())
    else:
        return dt
234601
public static function timeOf($key)
    {
        static::$with_meta = true;

        $cache = static::get($key);

        static::$with_meta = false;

        if ($cache == null) {
            return false;
        }

        return $cache['__bow_meta']['expire_at'];
    }
927735
public function has($key) {
        if (isset($this->store[$key])) {
            if ($this->ttl == 0) {
                return true;
            } else if ($this->store[$key][1] >= (cache::now() - $this->ttl)) {
                return true;
            }
        }
        return false;
    }
398201
public function check($key)
    {
        if (isset($this->timers[$key])) {
            return round((microtime(true) - $this->timers[$key]) * 1000, 2);
        }
    }
599867
protected function dateTimeLocal($key, $attributes)
    {
        if (isset($attributes['value']) && $attributes['value'] instanceof \DateTime) {
            $attributes['value'] = $attributes['value']->format('Y-m-d H:m:s');
        }

        return $this->composeElement($key, $attributes, ['type' => 'input'], true);
    }
346821
public static function has(string $key) : bool
  {
    $expect = explode('.', $key);
    $config = Config::all();

    foreach($expect as $setting) {
      if (!isset($config[$setting])) return false;
      $config = $config[$setting];
    }

    return true;
  }
1145939
public function __isset($key)
    {
        if ($this->hasCustomData()) {
            $theme = $this->getCustomData();
            return $theme->offsetExists($key);
        }

        return false;
    }
557201
protected function isValidTimeZoneId($timeZone)
    {
        return ($this->isValidIanaTimeZoneId($timeZone) !== false || $this->isValidCldrTimeZoneId($timeZone) !== false);
    }
1008321
private function validateTimezoneTime(int $hour, int $minutes): bool
    {
        if (!$this->validateHour($hour)) {
            return false;
        }
        if (!$this->validateMinutes($minutes)) {
            return false;
        }
        return true;
    }
683714
protected function modifierTimezone($input)
    {
        if ($input instanceof \DateTimeZone) return $input;

        try {
            $output = new \DateTimeZone($input);

            return $output;
        } catch (\Exception $exception) {
            if (!empty($this->log)) $this->log->error("Failed to convert \\DateTimeZone object from string " . $input);
        }

        return NULL;
    }
1114637
protected function validateTimezoneUser()
    {
        $field = 'timezone';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if (!isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $timezones = gplcart_timezones();

        if (empty($timezones[$value])) {
            $this->setErrorInvalid($field, $this->translation->text('Timezone'));
            return false;
        }

        return true;
    }
473401
protected function isValidIanaTimeZoneId($timeZone)
    {
        if (in_array($timeZone, $this->validTimeZones)) {
            return true;
        }

        $valid = array();
        $tza   = timezone_abbreviations_list();

        foreach ($tza as $zone) {
            foreach ($zone as $item) {
                $valid[$item['timezone_id']] = true;
            }
        }

        unset($valid['']);

        if (isset($valid[$timeZone]) || in_array($timeZone, timezone_identifiers_list(\DateTimeZone::ALL_WITH_BC))) {
            $this->validTimeZones[] = $timeZone;

            return true;
        }

        return false;
    }
1241272
protected function validateStoreTimezoneInstall()
    {
        $field = 'store.timezone';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if (empty($value)) {
            $this->setSubmitted($field, date_default_timezone_get());
            return true;
        }

        $timezones = gplcart_timezones();

        if (empty($timezones[$value])) {
            $this->setErrorInvalid($field, $this->translation->text('Timezone'));
            return false;
        }

        return true;
    }