// 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
// --------------------------------------------------------------------
/**
* Returns a callable method for a filter position
* using the local HTTP instances.
*
* @param FilterInterface|string $filter The filter instance, class, or alias
* @param string $position "before" or "after"
*/