For number/range inputs, check if the number is between the values.

For strings, check the length of the string.

@param  array $params
@return array
191418
protected function between( $params ) {
		list ( $min, $max ) = $params;

		if ( $this->is_numeric() ) {
			return [
				'min' => $min,
				'max' => $max,
			];
		}

		return [
			'minlength' => $min,
			'maxlength' => $max,
		];
	}
689610
private static function parseInputToInt($params)
    {
        return is_array($params) ? array_map(function ($item) {
            return intval($item);
        }, $params) : intval($params);
    }
415748
protected function convertParamsToQuery(array $params)
    {
        $query = array();

        foreach ($params as $key => $val) {
            if (is_array($val)) {
                $val = implode(',', $val);
            } elseif ($val instanceof \DateTime) {
                $val = $val->format('Y-m-d');
            } elseif (is_bool($val)) {
                if ($val) {
                    $val = 1;
                } else {
                    continue;
                }
            } else {
                $val = urlencode($val);
            }
            $query[] = $key . '=' . $val;
        }

        return implode('&', $query);
    }
1344095
public function params($params) {

		if(false === is_array($params)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($data)), E_USER_ERROR);
		}

		$this -> params = $params;

		return $this;
	}
369612
protected function parseRelationshipParams(array $params): array
    {
        if (empty($params)) {
            return [];
        }
        $parsed = [];
        foreach ($params as $key => $value) {
            # loop through
            if (is_int($key)) {
                $parsed[$key] = '';
                continue;
            }
            if ($key !== 'paginate' || ($key === 'paginate' && !Arr::isAssoc($value))) {
                $key = $key === 'paginate' ? 'limit' : $key;
                $parsed[$key] = implode('|', $value);

            } else {
                $limit = $this->findInArray($value, 'limit', 0, 10);
                $offset = $this->findInArray($value, 'offset', 1, 0);
                $parsed['limit'] = $limit . '|' . $offset;
            }
        }
        return $parsed;
    }
1260290
protected function getArgumentsFromParams($params)
    {
        $args     = array();
        $excludes = array("name", "before", "separator", "after", "fields");

        if (is_array($params)) {
            foreach ($params as $key => $value) {
                if (!in_array($key, $excludes)) {
                    $args[$key] = $value;
                }
            }
        }

        return $args;
    }
500037
public static function parseArray(array $params): array
    {
        $args = $sOpts = $lOpts = [];

        foreach ($params as $key => $val) {
            if (\is_int($key)) { // as argument
                $args[$key] = $val;
                continue;
            }

            $cleanKey = \trim((string)$key, '-');

            if ('' === $cleanKey) { // as argument
                $args[] = $val;
                continue;
            }

            if (0 === \strpos($key, '--')) { // long option
                $lOpts[$cleanKey] = $val;
            } elseif (0 === \strpos($key, '-')) { // short option
                $sOpts[$cleanKey] = $val;
            } else {
                $args[$key] = $val;
            }
        }

        return [$args, $sOpts, $lOpts];
    }
1355738
private function _castInputParametersWithClosure($params) {
		$allowed_params = $this->_getAllowedParams();		
		foreach($params as $name => $value) {
			$array_idx = $name;
			$found = false;
			$found |= $this->_valueInArray($name, array_keys($allowed_params), $array_idx);
			$found |= $this->_valueInArray($this->_path . "[" . $name . "]", array_keys($allowed_params), $array_idx);
			// XML Response can't have dashes
			$found |= $this->_valueInArray(str_replace('-', '_', $name), array_keys($allowed_params), $array_idx);
			$found |= $this->_valueInArray($this->_path . "[" . str_replace('-', '_', $name) . "]", array_keys($allowed_params), $array_idx);

      if($found) {
        $closure = $allowed_params[$array_idx];
        $this->$array_idx = $closure ? $closure($value, $params) : $value;
      }
      if($array_idx == 0) {
        //print_r($params);
      }
		}
	}
831946
private function get_filter_params( $params ) {
		$priority      = 10;
		$accepted_args = 100;
		if ( is_array( $params ) ) {
			if ( count( $params ) >= 1 ) {
				$priority = $params[0];
			}
			if ( count( $params ) >= 2 ) {
				$accepted_args = $params[1];
			}
		}

		return [ $priority, $accepted_args ];
	}
281528
private function check($value, $params) {

		if(true === is_string($value) || is_numeric($value)) {
			return false === in_array(preg_match($params[0], $value), [false, 0]);
		}

		return false;
	}
1301968
protected function isValidParams(array $params): bool
    {
        static $mode_list = [STREAM_FILTER_READ => 1, STREAM_FILTER_WRITE => 1];

        return isset($params['enclosure'], $params['escape'], $params['mode'], $mode_list[$params['mode']])
            && 1 == strlen($params['enclosure'])
            && 1 == strlen($params['escape']);
    }
979913
protected function getQueryParams(array $params = []): string
    {
        if (empty($params)) {
            return '';
        }
        $query = $params['query'] ?? [];
        if (is_string($query)) {
            return $query;
        }
        return empty($query) ? '' : http_build_query($query);
    }
1129894
public static function input($params = array()) {

        if( !is_array($params) )
        {
            throw new \InvalidArgumentException("Arguments is not a Array". print_r($params, true));
        }

        $o = '<input ';
        $o .= (isset($params['type'])) ? " type='{$params['type']}'" : 'type="text"';
        $o .= (isset($params['id'])) ? " id='{$params['id']}'" : '';
        $o .= (isset($params['name'])) ? " name='{$params['name']}'" : '';
        $o .= (isset($params['class'])) ? " class='form-input text {$params['class']}'" : '';
        $o .= (isset($params['onclick'])) ? " onclick='{$params['onclick']}'" : '';
        $o .= (isset($params['onkeypress'])) ? " onkeypress='{$params['onkeypress']}'" : '';
        $o .= (isset($params['value'])) ? ' value="' . $params['value'] . '"' : '';
        $o .= (isset($params['length'])) ? " maxlength='{$params['length']}'" : '';
        $o .= (isset($params['width'])) ? " style='width:{$params['width']}px;'" : '';
        $o .= (isset($params['disabled'])) ? " disabled='{$params['disabled']}'" : '';
        $o .= (isset($params['placeholder'])) ? " placeholder='{$params['placeholder']}'" : '';
        $o .= (isset($params['accept'])) ? " accept='{$params['accept']}'" : '';
        $o .= (isset($params['maxlength'])) ? " maxlength='{$params['maxlength']}'" : '';
        $o .= (isset($params['minlength'])) ? " minlength='{$params['minlength']}'" : '';
        $o .= (isset($params['style'])) ? " style='{$params['style']}'" : '';
        $o .= (isset($params['required'])) ? " required='required'" : '';
        $o .= (isset($params['autocomplete'])) ? " autocomplete='{$params['autocomplete']}'" : '';
        $o .= (isset($params['autofocus'])) ? " autofocus" : '';
        $o .= " />\n";
        return $o;
    }
563235
private function commands($params)
    {
        if (is_array($params)) {
            $param = '';
            $i = 0;
            $arrCount = count($params);

            foreach ($params as $key => $value) {
                $param .= $value;

                $comma = ($i < $arrCount - 1) ? ',' : '';

                $param .= $comma;

                $i++;
            }
        }

        if (is_string($params)) {
            $param = $params;
        }

        return $param;
    }
77053
function $min(params) {
    if (Array.isArray(params) && params.every(p => typeof p === 'number')) {
        return Math.min(...params);
    }
    throw new Error('$min expects an array of number');
}
1105041
public static function range($value, array $param)
    {
        return is_numeric($value) ? ($value >= $param[0] && $value <= $param[1]) : false;
    }
1165568
public function normalizeParams(array $params): array
    {
        foreach ($params as $key => $value) {
            if (false === \is_string($value) && false === \is_resource($value)) {
                $params[$key] = json_encode($value);
            }
        }

        return $params;
    }