\Cake\HttpActionDispatcher

This class provides compatibility with dispatcher filters and interacting with the controller layers.

Long term this should just be the controller dispatcher, but for now it will do a bit more than that.

Summary

Methods
Properties
Constants
eventManager()
getEventManager()
setEventManager()
dispatchEvent()
__construct()
dispatch()
addFilter()
getFilters()
No public properties found
No constants found
_invoke()
$_eventManager
$_eventClass
$filters
$factory
N/A
No private methods found
No private properties found
N/A

Properties

$_eventClass

$_eventClass : string

Default class name for new event objects.

Type

string

Methods

eventManager()

eventManager(\Cake\Event\EventManager|null  $eventManager = null) : \Cake\Event\EventManager

Returns the Cake\Event\EventManager manager instance for this object.

You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.

Parameters

\Cake\Event\EventManager|null $eventManager

the eventManager to set

Returns

\Cake\Event\EventManager

getEventManager()

getEventManager() : \Cake\Event\EventManager

Returns the Cake\Event\EventManager manager instance for this object.

You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.

Returns

\Cake\Event\EventManager

setEventManager()

setEventManager(\Cake\Event\EventManager  $eventManager) : $this

Returns the Cake\Event\EventManager manager instance for this object.

You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.

Parameters

\Cake\Event\EventManager $eventManager

the eventManager to set

Returns

$this

dispatchEvent()

dispatchEvent(string  $name, array|null  $data = null, object|null  $subject = null) : \Cake\Event\Event

Wrapper for creating and dispatching events.

Returns a dispatched event.

Parameters

string $name

Name of the event.

array|null $data

Any value you wish to be transported with this event to it can be read by listeners.

object|null $subject

The object that this event applies to ($this by default).

Returns

\Cake\Event\Event

__construct()

__construct(\Cake\Http\ControllerFactory|null  $factory = null, \Cake\Event\EventManager|null  $eventManager = null, array<mixed,\Cake\Event\EventListenerInterface>  $filters = array()) 

Constructor

Parameters

\Cake\Http\ControllerFactory|null $factory

A controller factory instance.

\Cake\Event\EventManager|null $eventManager

An event manager if you want to inject one.

array<mixed,\Cake\Event\EventListenerInterface> $filters

The list of filters to include.

dispatch()

dispatch(\Cake\Http\ServerRequest  $request, \Cake\Http\Response  $response) : \Cake\Http\Response

Dispatches a Request & Response

Parameters

\Cake\Http\ServerRequest $request

The request to dispatch.

\Cake\Http\Response $response

The response to dispatch.

Throws

\ReflectionException

Returns

\Cake\Http\Response

A modified/replaced response.

addFilter()

addFilter(\Cake\Event\EventListenerInterface  $filter) : void

Add a filter to this dispatcher.

The added filter will be attached to the event manager used by this dispatcher.

Parameters

\Cake\Event\EventListenerInterface $filter

The filter to connect. Can be any EventListenerInterface. Typically an instance of \Cake\Routing\DispatcherFilter.

getFilters()

getFilters() : array

Get the connected filters.

Returns

array

_invoke()

_invoke(\Cake\Controller\Controller  $controller) : \Cake\Http\Response

Invoke a controller's action and wrapping methods.

Parameters

\Cake\Controller\Controller $controller

The controller to invoke.

Throws

\LogicException

If the controller action returns a non-response value.

Returns

\Cake\Http\Response

The response