Filters example

if ($this->resetRoutes) {
            $routes->resetRoutes();
        }

        return new Router($routes$request);
    }

    private function createFilters(Request $request): Filters
    {
        $config = config(FiltersConfig::class);

        return new Filters($config$request, Services::response());
    }
}

    public static function filters(?FiltersConfig $config = null, bool $getShared = true)
    {
        if ($getShared) {
            return static::getSharedInstance('filters', $config);
        }

        $config ??= config(FiltersConfig::class);

        return new Filters($config, AppServices::request(), AppServices::response());
    }

    /** * The Format class is a convenient place to create Formatters. * * @return Format */
    public static function format(?FormatConfig $config = null, bool $getShared = true)
    {
        if ($getShared) {
            return static::getSharedInstance('format', $config);
        }
return;
        }

        // Create our own Request and Response so we can         // use the same ones for Filters and FilterInterface         // yet isolate them from outside influence         $this->request ??= clone Services::request();
        $this->response ??= clone Services::response();

        // Create our config and Filters instance to reuse for performance         $this->filtersConfig ??= config(FiltersConfig::class);
        $this->filters ??= new Filters($this->filtersConfig, $this->request, $this->response);

        if ($this->collection === null) {
            $this->collection = Services::routes()->loadRoutes();
        }

        $this->doneFilterSetUp = true;
    }

    // --------------------------------------------------------------------     // Utility     // --------------------------------------------------------------------
Home | Imprint | This part of the site doesn't use cookies.