Get the rate limit values from the values of the widget.

@param string $name
@param int $defaultTimeWindow the value of the time window if the max requests is empty and the received time window is invalid

@throws UserMessageException

@return array
502754
public function fromWidgetHtml($name, $defaultTimeWindow = 3600)
    {
        $post = $this->request->request;

        $s = $post->get($name . '_maxRequests');
        $maxRequests = (is_scalar($s) && is_numeric($s)) ? (int) $s : null;
        if ($maxRequests !== null && $maxRequests <= 0) {
            throw new UserMessageException(t('Please specify a positive integer for the maximum number of requests (or leave it empty)'));
        }
        try {
            $timeWindow = $this->joinTimeWindow($post->get($name . '_timeWindow_value'), $post->get($name . '_timeWindow_unit'), true);
        } catch (UserMessageException $x) {
            if ($maxRequests === null) {
                $timeWindow = $defaultTimeWindow;
            } else {
                throw $x;
            }
        }

        return [$maxRequests, $timeWindow];
    }
542524
def rate_limit(self, name, limit=5, per=60, debug=False):
        
        return RateLimit(self, name, limit, per, debug)
541973
protected function getParameter($name, $defaultValue)
    {
        return $this->hasRequestParameter($name)
            ? html_entity_decode($this->getRequestParameter($name))
            : $defaultValue;
    }
196681
protected function stat($time, $name)
    {
        $stats = $this->get('stats', ['interval' => $time], (string) $time);

        return array_get($stats, 'response.result.objs.0.'.$name);
    }
466373
public function getValues(string $name, array $default = []): array
    {
        $key = strtolower($name);
        if (!array_key_exists($key, $this->headers)) {
            return $default;
        }

        return $this->headers[$key]->getValuesAsArray();
    }
1139890
protected function getInlineOption($name, $str, $defaultValue)
	{
		if(preg_match('/'.$name.'(\s*=\s*(\d+))?/i', $str, $v) && count($v) > 2)
			return $v[2];
		else
			return $defaultValue;
	}
1182112
public function getMessages($name = null)
    {
        !$name && $name = $this->name;
        $this->negative && $this->addError('negative');

        $this->loadTranslationMessages();

        $messages = array();
        foreach ($this->errors as $optionName => $message) {
            preg_match_all('/\%(.+?)\%/', $message, $matches);
            $parameters = array();
            foreach ($matches[1] as $match) {
                if ('name' == $match) {
                    $parameters['%name%'] = $this->t($name);
                } else {
                    if (!property_exists($this, $match)) {
                        throw new \UnexpectedValueException(sprintf('Unknown parameter "%%%s%%" in message "%s"', $match, $message));
                    }
                    $parameters['%' . $match . '%'] = is_array($this->$match) ?
                        implode(', ', $this->$match) : $this->$match;
                }
            }
            $messages[$optionName] = $this->t($message, $parameters);
        }
        return $messages;
    }
1303134
public function getRequestValue($name, $default = null)
    {
        $request = $this->getModule()->getRequest();

        return isset($request->request[$name]) ? $request->request[$name] : $request->query($name, $default);
    }
770830
private function getValue(array $properties, $name, $defaultValue)
    {
        $propertyName = 'phing.log.mail.' . $name;
        $value = $properties[$propertyName];
        if ($value === null) {
            $value = $defaultValue;
        }
        if ($value === null) {
            throw new BadMethodCallException('Missing required parameter: ' . $propertyName);
        }
        return $value;
    }
795931
protected function getRateLimitValuesByHeader($headerName)
    {
        $header = $this->getHeaders()[$headerName];
        
        return $header ? array_reduce(explode(',', $header[0]), function ($limits, $limitStr) {
            list($count, $time) = explode(':', $limitStr, 2);
            $limits[$time] = (int) $count;
            
            return $limits;
        }, []) : null;
    }
400873
public function getUserSetting(User $user, $name, $default = null)
    {
        if (false === $user->getSettings()->containsKey($name)) {
            $this->loadusersSettings();

            return array_key_exists($name, $this->usersSettings) ? $this->usersSettings[$name] : $default;
        }

        return $user->getSettings()->get($name)->getValue();
    }
15558
public function get($name = null, $defaultValue = null)
    {
        if ($name == null) return $_GET;
        $rs = isset($_GET[$name]) ? $_GET[$name] : $defaultValue;
        //Collect.category_id 获取 Collect[category_id]
        if ($rs == null && stripos($name, '.') > 0) {
            $arr = explode('.', $name);
            $rs2 = $_GET[$arr[0]];
            if (isset($rs2[$arr[1]])) {
                $rs = $rs2[$arr[1]];
            }
        }
        return $rs;
    }
140203
public static function getPutParameter(string $name, string $default = null, array $allowed = null): string
    {
        return self::get('PUT', $name, $default, $allowed);
    }
1214400
protected function getBoundValue($name, $default)
    {
        $inputName = preg_split('/[\[\]]+/', $name, -1, PREG_SPLIT_NO_EMPTY);
        if (count($inputName) == 2 && in_array($inputName[1], $this->locales)) {
            list($name, $lang) = $inputName;
            $translation = $this->boundData->data()->getTranslation($name, $lang);
            $value = $translation ?: '';

            return $value;
        }

        return $this->boundData->get($name, $default);
    }
1002376
protected function getMultipleRawOptionValue($name, $value, $defaultValue)
    {
        $modelVariable = $this->getSingularVariable($this->modelName);
        $valueString = 'null';

        if (!is_null($value)) {
            $valueString = starts_with($value, '$') ? sprintf("%s", $value) : sprintf("'%s'", $value);
        }

        $defaultValueString = '[]';

        if (!empty($defaultValue)) {
            $joinedValues = implode(',', Helpers::wrapItems((array) $defaultValue));
            $defaultValueString = sprintf('[%s]', $joinedValues);
        }

        $accessor = $this->getDefaultValueAccessor($modelVariable, $name, $defaultValueString);

        return sprintf("in_array(%s, old('%s', %s) ?: [])", $valueString, $name, $accessor);
    }
758490
public static function get($name, $defaultValue = null)
    {
        $model = self::find()->where([self::getNameAttribute() => $name])->asArray()->one();
    
        if ($model) {
            return $model[self::getValueAttribute()];
        }
    
        return $defaultValue;
    }
70825
public function get($name, $default = false)
    {
        $this->readTimes++;

        $value = $this->handler->get($this->getCacheKey($name));

        if (is_null($value) || false === $value) {
            return $default;
        }

        return $this->unserialize($value);
    }