src/Router.php
public function boot($app)
    {
        $this->app = $app;

        $routerConfig = $this->app->config['router'] ?? [];
        $this->routeMap['routes'] = array_merge($this->routeMap['routes'] ?? [], $routerConfig['routes'] ?? []);
        $this->routeMapParse = array_merge($routerConfig['routes'] ?? [], $this->routeMapParse ?? []);

        $annotationRoute = $this->routerConfig->get('annotation', false);
        if ($annotationRoute === true) {
            if (PHP_SAPI !== 'cli') {
                $routesFile = 'routes.php';
                $controllersFile = 'controllers.php';
                $usedControllers = [];
                $controllerDirs = [APP_DIR . 'Controller/'];
                $cacheDir = APP_DIR . 'View/cache/';

                if (!is_array($controllerDirs)) {
                    throw new InvalidArgumentException('Controllers directory must be either string or array');
                }

                $this->controllerDirs = [];
                foreach ($controllerDirs as $d) {
                    $realPath = realpath($d);
                    if ($realPath !== false) {
                        $this->controllerDirs[] = $realPath;
                    }
                }

                // We save the cache dir
                if (!is_dir($cacheDir)) {
                    if (!mkdir($cacheDir, 0777, true)) {
                        throw new RuntimeException('Can\'t create cache directory');
                    }
                }

                if (!is_writable($cacheDir)) {
                    throw new RuntimeException('Cache directory must be writable by web server');
                }

                $this->cacheDir = rtrim($cacheDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
                $this->generateRoutes();

                $routesConfig = Config::load('routes', APP_DIR . 'View/cache/')->get();
                if (!empty($routesConfig)) {
                    $this->routeMapParse = array_merge($routesConfig, $this->routeMapParse);
                    $this->routeMap['routes'] = array_merge($routesConfig, $this->routeMap['routes']);
                }
            }
        }

        return $this;
    }
public function boot($app)
    {
        $this->app = $app;

        $routerConfig = $this->app->config['router'] ?? [];
        $this->routeMap['routes'] = array_merge($this->routeMap['routes'] ?? [], $routerConfig['routes'] ?? []);
        $this->routeMapParse = array_merge($routerConfig['routes'] ?? [], $this->routeMapParse ?? []);

        $annotationRoute = $this->routerConfig->get('annotation', false);
        if ($annotationRoute === true) {
            if (PHP_SAPI !== 'cli') {
                $routesFile = 'routes.php';
                $controllersFile = 'controllers.php';
                $usedControllers = [];
                $controllerDirs = [APP_DIR . 'Controller/'];
                $cacheDir = APP_DIR . 'View/cache/';

                if (!is_array($controllerDirs)) {
                    throw new InvalidArgumentException('Controllers directory must be either string or array');
                }

                $this->controllerDirs = [];
                foreach ($controllerDirs as $d) {
                    $realPath = realpath($d);
                    if ($realPath !== false) {
                        $this->controllerDirs[] = $realPath;
                    }
                }

                // We save the cache dir
                if (!is_dir($cacheDir)) {
                    if (!mkdir($cacheDir, 0777, true)) {
                        throw new RuntimeException('Can\'t create cache directory');
                    }
                }

                if (!is_writable($cacheDir)) {
                    throw new RuntimeException('Cache directory must be writable by web server');
                }

                $this->cacheDir = rtrim($cacheDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
                $this->generateRoutes();

                $routesConfig = Config::load('routes', APP_DIR . 'View/cache/')->get();
                if (!empty($routesConfig)) {
                    $this->routeMapParse = array_merge($routesConfig, $this->routeMapParse);
                    $this->routeMap['routes'] = array_merge($routesConfig, $this->routeMap['routes']);
                }
            }
        }

        return $this;
    }
__construct Class

@param $app

@return $this