src/Core/Application.php
public function getResponse(array $packageList, array $languageList, array $customRouteList, string $url = ''): Response
    {
        $request = new Request($languageList, $packageList, $url);

        $this->packageRoot .= 'package/' . $request->package() . '/';

        try {
            /**
             * Process request.
             */
            if (isset($customRouteList[$request->package()])) {
                /**
                 * Path to custom router class.
                 */
                $path = $this->packageRoot . 'CustomRoute.php';
                if (file_exists($path)) {
                    require $path;
                    $route = $request->package() . '\\CustomRoute';
                    /**
                     * @var IRoute $route
                     */
                    $route = new $route();
                    $this->response = $route->getResponse($this->packageRoot, $request);
                    if ($this->response->is404()) {
                        $this->set404();
                    }
                    return $this->response;
                } else {
                    throw new RouteException(sprintf('The file "%s" does not exist', $path));
                }
            } else {
                $this->response = (new DefaultRoute())->getResponse($this->packageRoot, $request);
                if ($this->response->is404()) {
                    $this->set404();
                }
                return $this->response;
            }
        } catch (RouteException $e) {
            if (Wrap::isEnabled()) {
                throw $e;
            } else {
                $this->response = new Response();
                $this->set404();
                return $this->response;
            }
        }
    }
public function getResponse(array $packageList, array $languageList, array $customRouteList, string $url = ''): Response
    {
        $request = new Request($languageList, $packageList, $url);

        $this->packageRoot .= 'package/' . $request->package() . '/';

        try {
            /**
             * Process request.
             */
            if (isset($customRouteList[$request->package()])) {
                /**
                 * Path to custom router class.
                 */
                $path = $this->packageRoot . 'CustomRoute.php';
                if (file_exists($path)) {
                    require $path;
                    $route = $request->package() . '\\CustomRoute';
                    /**
                     * @var IRoute $route
                     */
                    $route = new $route();
                    $this->response = $route->getResponse($this->packageRoot, $request);
                    if ($this->response->is404()) {
                        $this->set404();
                    }
                    return $this->response;
                } else {
                    throw new RouteException(sprintf('The file "%s" does not exist', $path));
                }
            } else {
                $this->response = (new DefaultRoute())->getResponse($this->packageRoot, $request);
                if ($this->response->is404()) {
                    $this->set404();
                }
                return $this->response;
            }
        } catch (RouteException $e) {
            if (Wrap::isEnabled()) {
                throw $e;
            } else {
                $this->response = new Response();
                $this->set404();
                return $this->response;
            }
        }
    }
Process request.

@param array $packageList
@param array $languageList
@param array $customRouteList
@param string $url

@return Response
@throws RouteException