Bluz\Router\Router::urlRoute PHP Method

urlRoute() protected method

Build URL by default route
protected urlRoute ( string $module, string $controller, array $params ) : string
$module string
$controller string
$params array
return string
    protected function urlRoute($module, $controller, $params)
    {
        $url = $this->getBaseUrl();
        if (empty($params)) {
            if ($controller == self::DEFAULT_CONTROLLER) {
                if ($module == self::DEFAULT_MODULE) {
                    return $url;
                } else {
                    return $url . $module;
                }
            }
        }
        $url .= $module . '/' . $controller;
        $getParams = [];
        foreach ($params as $key => $value) {
            // sub-array as GET params
            if (is_array($value)) {
                $getParams[$key] = $value;
                continue;
            }
            $url .= '/' . urlencode($key) . '/' . urlencode($value);
        }
        if (!empty($getParams)) {
            $url .= '?' . http_build_query($getParams);
        }
        return $url;
    }