public function optionsMap(): array
    {
        $routes_list = $this->router->getRoutes();
        $final_routes = $modified_routes = [];

        foreach ($routes_list as $route) {
            if (isset($modified_routes[$route[1]]) === false) {
                $modified_routes[$route[1]] = [];
            }
            $modified_routes[$route[1]][] = $route[0];
        }

        foreach ($modified_routes as $route => $method) {
            $final_routes[] = ['OPTIONS', $route, function () use ($method) {
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ],
                        [
                            'Allow: ' . implode(',', $method)
                        ]
                    ],
                    "response" => ''
                ];
            }];
        }

        return $final_routes;
    }
public function optionsMap(): array
    {
        $routes_list = $this->router->getRoutes();
        $final_routes = $modified_routes = [];

        foreach ($routes_list as $route) {
            if (isset($modified_routes[$route[1]]) === false) {
                $modified_routes[$route[1]] = [];
            }
            $modified_routes[$route[1]][] = $route[0];
        }

        foreach ($modified_routes as $route => $method) {
            $final_routes[] = ['OPTIONS', $route, function () use ($method) {
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ],
                        [
                            'Allow: ' . implode(',', $method)
                        ]
                    ],
                    "response" => ''
                ];
            }];
        }

        return $final_routes;
    }
public function optionsMap ( ) : array { $ routes_list = $ this -> router -> getRoutes ( ) ; $ final_routes = $ modified_routes = [ ] ; foreach ( $ routes_list as $ route ) { if ( isset ( $ modified_routes [ $ route [ 1 ] ] ) === false ) { $ modified_routes [ $ route [ 1 ] ] = [ ] ; } $ modified_routes [ $ route [ 1 ] ] [ ] = $ route [ 0 ] ; } foreach ( $ modified_routes as $ route => $ method ) { $ final_routes [ ] = [ 'OPTIONS' , $ route , function ( ) use ( $ method ) { return [ "headers" => [ [ 'X-PHP-Response-Code: 200' , true , 200 ] , [ 'Allow: ' . implode ( ',' , $ method ) ] ] , "response" => '' ] ; } ] ; } return $ final_routes ; }
Returns the request map for OPTIONS requests

@return array
Returns the request map for OPTIONS requests