src/Router.php
public function makeUrl(string $url = null, $onlyExt = false)
    {
        $paramsHook = explode('#', $url);
        $params = explode('?', $paramsHook[0]);
        $params_ = explode('/', $params[0]);
        $task = $params_[0];
        $action = null;

        if (isset($params_[1]) and !empty($params_[1])) {
            $action = $params_[1];
        }

        if (isset($params[1])) {
            parse_str($params[1], $params);
        } else {
            $params = [];
        }

        $findKey = explode('?', $url);
        if (isset($findKey[0])) {
            $findKey = $findKey[0];
        }

        if (defined('MOD_REWRITE') and MOD_REWRITE === true) {
            if (isset($this->routeMap['routes'][$findKey])) {
                $expressionUrl = $this->routeMap['routes'][$findKey][0];
                foreach ($params as $key => $value) {
                    $expressionUrl = str_replace('[' . $key . ']', $value, $expressionUrl, $count);
                    if ($count > 0) {
                        unset($params[$key]);
                    }
                }

                if (isset($params)) {
                    if (isset($this->routeMap['routes'][$findKey]['_params'])) {
                        $expressionUrl = str_replace('[params]',
                            $this->parseParams($this->routeMap['routes'][$findKey]['_params'][0], $params),
                            $expressionUrl);
                    } elseif (!empty($params)) {
                        $expressionUrl = $expressionUrl . '?' . http_build_query($params);
                    }
                }
            } else {
                $expressionUrl = $this->routeMap['routes']['default'][0];
                $expressionUrl = str_replace('[task]', $task, $expressionUrl);
                $expressionUrl = str_replace('[action]', $action, $expressionUrl);
                if (isset($params)) {
                    $expressionUrl = str_replace('[params]',
                        $this->parseParams($this->routeMap['routes']['default']['_params'][0], $params),
                        $expressionUrl);
                }
            }
        } else {
            if (empty($task)) {
                $expressionUrl = '';
            } else {
                if (isset($this->routeMap['routes'][$findKey])) {
                    $expressionUrl0 = $this->routeMap['routes'][$findKey][1];
                    foreach ($params as $key => $value) {
                        $expressionUrl0 = str_replace('[' . $key . ']', $value, $expressionUrl0, $count);
                        if ($count > 0) {
                            unset($params[$key]);
                        }
                    }

                    $expressionUrl = $expressionUrl0;
                } else {
                    $expressionUrl = 'task=' . $task;
                    if (!empty($action)) {
                        $expressionUrl = 'task=' . $task . '&action=' . $action;
                    }
                }

                if (!empty($params)) {
                    if (!empty($expressionUrl)) {
                        $expressionUrl .= '&';
                    }
                    $expressionUrl = $expressionUrl . http_build_query($params);
                }
                $expressionUrl = 'index.php?' . $expressionUrl;
            }
        }

        $parsedUrl = \parse_url($this->domain);

        if (isset($parsedUrl['scheme'])) {
            $this->requestPrefix = $parsedUrl['scheme'] . '://';
            $this->domain = ltrim($this->domain, $parsedUrl['scheme'] . '://');
        }

        $HTTP_HOST = $this->domain;

        if (!empty($this->subdomain)) {
            $HTTP_HOST = $this->subdomain . '.' . $this->domain;
        }

        $url = null;
        if ($onlyExt === false) {
            $url = $this->requestPrefix . $HTTP_HOST . '/';
        }

        $url .= $expressionUrl;
        $url = rtrim($url, '/');

        unset($this->subdomain);
        $this->domain = HTTP_HOST;
        //$this->setHttps($this->routerConfig->get('https', false));

        return $url;
    }
public function makeUrl(string $url = null, $onlyExt = false)
    {
        $paramsHook = explode('#', $url);
        $params = explode('?', $paramsHook[0]);
        $params_ = explode('/', $params[0]);
        $task = $params_[0];
        $action = null;

        if (isset($params_[1]) and !empty($params_[1])) {
            $action = $params_[1];
        }

        if (isset($params[1])) {
            parse_str($params[1], $params);
        } else {
            $params = [];
        }

        $findKey = explode('?', $url);
        if (isset($findKey[0])) {
            $findKey = $findKey[0];
        }

        if (defined('MOD_REWRITE') and MOD_REWRITE === true) {
            if (isset($this->routeMap['routes'][$findKey])) {
                $expressionUrl = $this->routeMap['routes'][$findKey][0];
                foreach ($params as $key => $value) {
                    $expressionUrl = str_replace('[' . $key . ']', $value, $expressionUrl, $count);
                    if ($count > 0) {
                        unset($params[$key]);
                    }
                }

                if (isset($params)) {
                    if (isset($this->routeMap['routes'][$findKey]['_params'])) {
                        $expressionUrl = str_replace('[params]',
                            $this->parseParams($this->routeMap['routes'][$findKey]['_params'][0], $params),
                            $expressionUrl);
                    } elseif (!empty($params)) {
                        $expressionUrl = $expressionUrl . '?' . http_build_query($params);
                    }
                }
            } else {
                $expressionUrl = $this->routeMap['routes']['default'][0];
                $expressionUrl = str_replace('[task]', $task, $expressionUrl);
                $expressionUrl = str_replace('[action]', $action, $expressionUrl);
                if (isset($params)) {
                    $expressionUrl = str_replace('[params]',
                        $this->parseParams($this->routeMap['routes']['default']['_params'][0], $params),
                        $expressionUrl);
                }
            }
        } else {
            if (empty($task)) {
                $expressionUrl = '';
            } else {
                if (isset($this->routeMap['routes'][$findKey])) {
                    $expressionUrl0 = $this->routeMap['routes'][$findKey][1];
                    foreach ($params as $key => $value) {
                        $expressionUrl0 = str_replace('[' . $key . ']', $value, $expressionUrl0, $count);
                        if ($count > 0) {
                            unset($params[$key]);
                        }
                    }

                    $expressionUrl = $expressionUrl0;
                } else {
                    $expressionUrl = 'task=' . $task;
                    if (!empty($action)) {
                        $expressionUrl = 'task=' . $task . '&action=' . $action;
                    }
                }

                if (!empty($params)) {
                    if (!empty($expressionUrl)) {
                        $expressionUrl .= '&';
                    }
                    $expressionUrl = $expressionUrl . http_build_query($params);
                }
                $expressionUrl = 'index.php?' . $expressionUrl;
            }
        }

        $parsedUrl = \parse_url($this->domain);

        if (isset($parsedUrl['scheme'])) {
            $this->requestPrefix = $parsedUrl['scheme'] . '://';
            $this->domain = ltrim($this->domain, $parsedUrl['scheme'] . '://');
        }

        $HTTP_HOST = $this->domain;

        if (!empty($this->subdomain)) {
            $HTTP_HOST = $this->subdomain . '.' . $this->domain;
        }

        $url = null;
        if ($onlyExt === false) {
            $url = $this->requestPrefix . $HTTP_HOST . '/';
        }

        $url .= $expressionUrl;
        $url = rtrim($url, '/');

        unset($this->subdomain);
        $this->domain = HTTP_HOST;
        //$this->setHttps($this->routerConfig->get('https', false));

        return $url;
    }
Generate url

@param string|null $url
@param string|bool $onlyExt

@return null|string