A reverse routing helper.

@throws \UnexpectedValueException

@param  array  $params Parameters to set named options to
@return string
498004
public function url($params = array())
	{
		if ($this->isStatic())
		{
			return $this->pattern;
		}

		$url = $this->pattern;

		foreach ($this->getSegments($url) as $segment)
		{
			$func = $segment['optional'] === true ? 'replaceOptional' : 'replaceRequired';
			$url = $this->{$func}($url, $segment['name'], $segment['token'], $params);
		}

		return $url;
	}
832269
public function setParamsSort(array $params) {
        if (is_numeric(key($params)) && key($params) == 0) {
            $tmp = [];
            foreach ($params as $key => $value) {
                $tmp[$key + 1] = $value;
            }
            $params = $tmp;
        }

        return $params;
    }
301624
public static function maybe_split_parameters( $params ) {
		if ( ! \is_array( $params ) ) {
			// We can safely cast to an array here, as long as $params convertible to a string.
			$params = (array) \preg_split( self::RE_PARAMETER_SPLITTING, $params, -1, PREG_SPLIT_NO_EMPTY );
		}

		return $params;
	}
162648
public function html_anchor($params) {
        if (!isset($params['href'])) {
            throw new \UnexpectedValueException("The href parameter is required.");
        }
        if (!isset($params['text'])) {
            throw new \UnexpectedValueException("The text parameter is required.");
        }
        $attrs = isset($params['folder']) ? $params['folder'] : array();
        $secure = isset($params['secure']) ? $params['secure'] : null;
        return Html::anchor($params['file'], $params['text'], $attrs, $secure);
    }
1320600
protected function getURL(array $params):string{
		$url = '';

		if($this->scheme){
			$url .= $this->scheme.':';
		}

		if($this->host){
			$url .= '//'.$this->host;

			if($this->port){
				$url .= ':'.$this->port;
			}

		}

		if($this->path){
			$url .= $this->path;
		}

		if(!empty($params)){
			$url .= '?'.http_build_query($params);
		}

		if($this->fragment){
			$url .= '#'.$this->fragment;
		}

		return $url;
	}
1027899
protected function _params2string($params)
    {
        if (!count($params)) {
            return '';
        }
        $paramsPart = array();
        foreach ($params as $name => $value) {
            if (!$value && ('0' !== $value)) {
                continue;
            }
            $paramsPart[] = str_replace(array('{name}', '{value}'), array($name, urlencode($value)), $this->paramsPairStructure);
        }
        if (!count($paramsPart)) {
            return '';
        }
        return '/' . implode($this->paramsSeparator, $paramsPart);
    }
798458
public function session_get_flash($params) {
        if (!isset($params['var'])) {
            throw new \UnexpectedValueException("The var parameter is required.");
        }
        $default = isset($params['default']) ? $params['default'] : null;
        $expire = isset($params['expire']) ? $params['expire'] : false;
        return Session::get_flash($params['var'], $default, $expire);
    }
488041
public function computePath($params) {
    $route = $this->getPath();

    if (!preg_match_all(
      '~' . self::VARIABLE_REGEX . '~x', $route, $matches,
      PREG_OFFSET_CAPTURE | PREG_SET_ORDER
    )) {
      return $route;
    }

    $offset = 0;
    $url = '';

    /** @var string[] $matches */
    foreach ($matches as $set) {
      if ($set[0][1] > $offset) {
        $url .= substr($route, $offset, $set[0][1] - $offset);
      }
      if(isset($params[$set[1][0]])) {
        $url .= $params[$set[1][0]];
      } else {
        throw new \InvalidArgumentException(sprintf('No value supplied for "%s"', $set[1][0]));
      }
      $offset = $set[0][1] + strlen($set[0][0]);
    }
    if ($offset !== strlen($route)) {
      $url .= substr($route, $offset);
    }

    return $url;
  }
1087657
public function setParams($params)
    {
        if (!empty($params)) {
            foreach ($params as $key => $value) {
                $this->options[ 'json' ][ $key ] = $value;
            }
        }
        return $this;
    }
663090
public function unserializeParams($params) {
		$parts = explode($this->options['param-delimiter'], $params);
		$params = [];
		foreach ($parts as $part) {
			$kv = explode('=', $part);
			if ($kv[0] != '') {
				$value = count($kv) > 1
					? $kv[1] == $this->options['param-true'] ? true
					: ($kv[1] == $this->options['param-false'] ? false : $kv[1]) : true;
				$params = $this->setParam($params, $kv[0], $value);
			}
		}
		
		return $params;
	}
754692
public function getParameterByName($name) {
    $name = ltrim($name, '$');
    /** @var ParameterNode $parameter */
    foreach ($this->getParameters()->reverse() as $parameter) {
      if ($parameter->getName() === $name) {
        return $parameter;
      }
    }
    throw new \UnexpectedValueException("Parameter {$name} does not exist.");
  }
33605
private function toArray($params) {
		if(is_array($params)) {
			return $params;
		}
		if(is_object($params)) {
			return ArrayHelper::toArray($params);
		}
		throw new InvalidMethodParameterException;
	}
1058821
public static function fromResponseParameters(array $parameters, Context $context = null)
    {
        if (empty($parameters['responseFingerprintOrder'])) {
            throw new \UnexpectedValueException('The responseFingerprintOrder parameter is missing');
        }

        $self = static::fromParameters($parameters);
        $self->setFingerprintOrder(explode(',', $parameters['responseFingerprintOrder']));

        if (null !== $context) {
            $self->setContext($context);
        }

        return $self;
    }
1134215
public function form_reset($params) {
        if (!isset($params['field'])) {
            throw new \UnexpectedValueException("The field parameter is required.");
        }
        $value = isset($params['value']) ? $params['value'] : null;
        $attributes = isset($params['attrs']) ? $params['attrs'] : array();
        return Form::reset($params['field'], $value, $attributes);
    }
458597
public function loadParams(array $params)
    {
        $this->arguments = array();
        $this->options = array();

        foreach ($params as $param) {
            if (strpos($param, '-') !== false) {
                $this->options[] = $this->extractOption($param);
            } else {
                $this->arguments[] = $param;
            }
        }

        return $this;
    }
564828
public function form_password($params) {
        if (!isset($params['field'])) {
            throw new \UnexpectedValueException("The field parameter is required.");
        }
        $value = isset($params['value']) ? $params['value'] : null;
        $attributes = isset($params['attrs']) ? $params['attrs'] : array();
        return Form::password($params['field'], $value, $attributes);
    }
428705
public function getHandler(...$params): array
    {
        list($path, $method) = $params;
        // list($path, $info) = $router;

        return $this->match($path, $method);
    }