Server
    
            
            in package
            
        
    
            
            implements
                            EventDispatcherInterface                    
    
            
            uses
                            EventDispatcherTrait                    
    
Runs an application invoking all the PSR7 middleware and the registered application.
Table of Contents
Interfaces
- EventDispatcherInterface
- Objects implementing this interface can emit events.
Properties
- $_eventClass : string
- Default class name for new event objects.
- $_eventManager : EventManagerInterface|null
- Instance of the Cake\Event\EventManager this object is using to dispatch inner events.
- $app : HttpApplicationInterface
- $runner : Runner
Methods
- __construct() : mixed
- Constructor
- dispatchEvent() : EventInterface
- Wrapper for creating and dispatching events.
- emit() : void
- Emit the response using the PHP SAPI.
- getApp() : HttpApplicationInterface
- Get the current application.
- getEventManager() : EventManagerInterface
- Get the application's event manager or the global one.
- run() : ResponseInterface
- Run the request/response through the Application and its middleware.
- setEventManager() : $this
- Set the application's event manager.
- bootstrap() : void
- Application bootstrap wrapper.
Properties
$_eventClass
Default class name for new event objects.
    protected
        string
    $_eventClass
     = \Cake\Event\Event::class
    
    
    
    
$_eventManager
Instance of the Cake\Event\EventManager this object is using to dispatch inner events.
    protected
        EventManagerInterface|null
    $_eventManager
    
    
    
    
    
$app
    protected
        HttpApplicationInterface
    $app
    
    
    
    
    
$runner
    protected
        Runner
    $runner
    
    
    
    
    
Methods
__construct()
Constructor
    public
                    __construct(HttpApplicationInterface $app[, Runner|null $runner = null ]) : mixed
    Parameters
- $app : HttpApplicationInterface
- 
                    The application to use. 
- $runner : Runner|null = null
- 
                    Application runner. 
dispatchEvent()
Wrapper for creating and dispatching events.
    public
                    dispatchEvent(string $name[, array<string|int, mixed>|null $data = null ][, object|null $subject = null ]) : EventInterface
    Returns a dispatched event.
Parameters
- $name : string
- 
                    Name of the event. 
- $data : array<string|int, mixed>|null = null
- 
                    Any value you wish to be transported with this event to it can be read by listeners. 
- $subject : object|null = null
- 
                    The object that this event applies to ($this by default). 
Return values
EventInterfaceemit()
Emit the response using the PHP SAPI.
    public
                    emit(ResponseInterface $response[, EmitterInterface|null $emitter = null ]) : void
    Parameters
- $response : ResponseInterface
- 
                    The response to emit 
- $emitter : EmitterInterface|null = null
- 
                    The emitter to use. When null, a SAPI Stream Emitter will be used. 
getApp()
Get the current application.
    public
                    getApp() : HttpApplicationInterface
    Return values
HttpApplicationInterface —The application that will be run.
getEventManager()
Get the application's event manager or the global one.
    public
                    getEventManager() : EventManagerInterface
    Return values
EventManagerInterfacerun()
Run the request/response through the Application and its middleware.
    public
                    run([ServerRequestInterface|null $request = null ][, MiddlewareQueue|null $middlewareQueue = null ]) : ResponseInterface
    This will invoke the following methods:
- App->bootstrap() - Perform any bootstrapping logic for your application here.
- App->middleware() - Attach any application middleware here.
- Trigger the 'Server.buildMiddleware' event. You can use this to modify the from event listeners.
- Run the middleware queue including the application.
Parameters
- $request : ServerRequestInterface|null = null
- 
                    The request to use or null. 
- $middlewareQueue : MiddlewareQueue|null = null
- 
                    MiddlewareQueue or null. 
Tags
Return values
ResponseInterfacesetEventManager()
Set the application's event manager.
    public
                    setEventManager(EventManagerInterface $eventManager) : $this
    If the application does not support events, an exception will be raised.
Parameters
- $eventManager : EventManagerInterface
- 
                    The event manager to set. 
Tags
Return values
$thisbootstrap()
Application bootstrap wrapper.
    protected
                    bootstrap() : void
    Calls the application's bootstrap() hook. After the application the
plugins are bootstrapped.