CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.3 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.3
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
      • Client
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Class MiddlewareQueue

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.

Namespace: Cake\Http

Property Summary

  • $callables protected
    array

    The queue of middleware callables.

  • $queue protected
    array

    The queue of middlewares.

Method Summary

  • add() public

    Append a middleware callable to the end of the queue.

  • count() public

    Get the number of connected middleware layers.

  • get() public

    Get the middleware at the provided index.

  • insertAfter() public

    Insert a middleware object after the first matching class.

  • insertAt() public

    Insert a middleware callable at a specific index.

  • insertBefore() public

    Insert a middleware object before the first matching class.

  • prepend() public

    Prepend a middleware to the start of the queue.

  • push() public

    Alias for MiddlewareQueue::add().

  • resolve() protected

    Resolve middleware name to callable.

Method Detail

add() ¶ public

add(callable|string|array $middleware): $this

Append a middleware callable to the end of the queue.

Parameters
callable|string|array $middleware

The middleware(s) to append.

Returns
$this

count() ¶ public

count(): int

Get the number of connected middleware layers.

Implement the Countable interface.

Returns
int

get() ¶ public

get(int $index): callable|null

Get the middleware at the provided index.

Parameters
int $index

The index to fetch.

Returns
callable|null

insertAfter() ¶ public

insertAfter(string $class, callable|string $middleware): $this

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().

Parameters
string $class

The classname to insert the middleware before.

callable|string $middleware

The middleware to insert.

Returns
$this

insertAt() ¶ public

insertAt(int $index, callable|string $middleware): $this

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.

Parameters
int $index

The index to insert at.

callable|string $middleware

The middleware to insert.

Returns
$this

insertBefore() ¶ public

insertBefore(string $class, callable|string $middleware): $this

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.

Parameters
string $class

The classname to insert the middleware before.

callable|string $middleware

The middleware to insert.

Returns
$this
Throws
LogicException
If middleware to insert before is not found.

prepend() ¶ public

prepend(callable|string|array $middleware): $this

Prepend a middleware to the start of the queue.

Parameters
callable|string|array $middleware

The middleware(s) to prepend.

Returns
$this

push() ¶ public

push(callable|string|array $middleware): $this

Alias for MiddlewareQueue::add().

Parameters
callable|string|array $middleware

The middleware(s) to append.

Returns
$this
See Also
MiddlewareQueue::add()

resolve() ¶ protected

resolve(int $index): callable|null

Resolve middleware name to callable.

Parameters
int $index

The index to fetch.

Returns
callable|null

Property Detail

$callables ¶ protected

The queue of middleware callables.

Type
array

$queue ¶ protected

The queue of middlewares.

Type
array
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs