Marshal middleware for use in the application.
This class provides a number of methods for preparing and returning
middleware for use within an application.
If any middleware provided is already a MiddlewareInterface, it can be used
verbatim or decorated as-is. Other middleware types acceptable are:
- PSR-15 RequestHandlerInterface instances; these will be decorated as
RequestHandlerMiddleware instances.
- string service names resolving to middleware
- arrays of service names and/or MiddlewareInterface instances
- PHP callables that follow the PSR-15 signature
Additionally, the class provides the following decorator/utility methods:
- callableMiddleware() will decorate the callable middleware passed to it using
CallableMiddlewareDecorator.
- handlerMiddleware() will decorate the request handler passed to it using
RequestHandlerMiddleware.
- lazyMiddleware() will decorate the string service name passed to it, along with the
factory instance, as a LazyLoadingMiddleware instance.
- pipeline() will create a MiddlewarePipe instance from the array of
middleware passed to it, after passing each first to prepare().