Prado\Web\TUrlMapping::constructUrl PHP Метод

constructUrl() публичный Метод

This method provides the actual implementation used by {@link THttpRequest::constructUrl}. Override this method if you want to provide your own way of URL formatting. If you do so, you may also need to override {@link parseUrl} so that the URL can be properly parsed. The URL is constructed as the following format: entryscript.php?serviceID=serviceParameter&get1=value1&... If {@link THttpRequest::setUrlFormat THttpRequest.UrlFormat} is 'Path', the following format is used instead: entryscript.php/serviceID/serviceParameter/get1,value1/get2,value2... If {@link THttpRequest::setUrlFormat THttpRequest.UrlFormat} is 'HiddenPath', the following format is used instead: serviceID/serviceParameter/get1,value1/get2,value2...
См. также: parseUrl
С версии: 3.1.1
public constructUrl ( $serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems ) : string
Результат string URL
    public function constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems)
    {
        if ($this->_customUrl) {
            if (!(is_array($getItems) || $getItems instanceof \Traversable)) {
                $getItems = array();
            }
            $key = $serviceID . ':' . $serviceParam;
            $wildCardKey = ($pos = strrpos($serviceParam, '.')) !== false ? $serviceID . ':' . substr($serviceParam, 0, $pos) . '.*' : $serviceID . ':*';
            if (isset($this->_constructRules[$key])) {
                foreach ($this->_constructRules[$key] as $rule) {
                    if ($rule->supportCustomUrl($getItems)) {
                        return $rule->constructUrl($getItems, $encodeAmpersand, $encodeGetItems);
                    }
                }
            } elseif (isset($this->_constructRules[$wildCardKey])) {
                foreach ($this->_constructRules[$wildCardKey] as $rule) {
                    if ($rule->supportCustomUrl($getItems)) {
                        $getItems['*'] = $pos ? substr($serviceParam, $pos + 1) : $serviceParam;
                        return $rule->constructUrl($getItems, $encodeAmpersand, $encodeGetItems);
                    }
                }
            }
        }
        return parent::constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems);
    }