Provides methods for creating and manipulating a "queue" of middleware callables. This queue is used to process a request and response via \Cake\Http\Runner.
$callables protected callable[]$queue protected array__construct( array $middleware = [] )
Constructor
$middleware optional [] add( callable|string|array $middleware )
Append a middleware callable to the end of the queue.
$middleware count( )
Get the number of connected middleware layers.
Implement the Countable interface.
Countable::count() get( integer $index )
Get the middleware at the provided index.
$index Either the callable middleware or null if the index is undefined.
insertAfter( string $class , callable|string $middleware )
Insert a middleware object after the first matching class.
Finds the index of the first middleware that matches the provided class, and inserts the supplied callable after it. If the class is not found, this method will behave like add().
$class $middleware insertAt( integer $index , callable|string $middleware )
Insert a middleware callable at a specific index.
If the index already exists, the new callable will be inserted, and the existing element will be shifted one index greater.
$index $middleware insertBefore( string $class , callable|string $middleware )
Insert a middleware object before the first matching class.
Finds the index of the first middleware that matches the provided class, and inserts the supplied callable before it.
$class $middleware prepend( callable|string|array $middleware )
Prepend a middleware to the start of the queue.
$middleware push( callable|string|array $middleware )
Alias for MiddlewareQueue::add().
$middleware resolve( integer $index )
Resolve middleware name to callable.
$index Either the callable middleware or null if the index is undefined.
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.8/class-Cake.Http.MiddlewareQueue.html