class CommandRequestHandler implements RequestHandlerInterface (View source)

A request handler which can handle command line requests.

Properties

protected Bootstrap $bootstrap
protected ObjectManagerInterface $objectManager
protected Dispatcher $dispatcher
protected Request $request
protected Response $response

Methods

__construct(Bootstrap $bootstrap)

No description

mixed
canHandleRequest()

This request handler can handle CLI requests.

int
getPriority()

Returns the priority - how eager the handler is to actually handle the request.

void
handleRequest()

Handles a command line request.

void
exitIfCompiletimeCommandWasNotCalledCorrectly(string $runlevel)

Checks if compile time command was not recognized as such, then runlevel was booted but it turned out that in fact the command is a compile time command.

void
boot(string $runlevel)

Initializes the matching boot sequence depending on the type of the command (RUNLEVEL_RUNTIME or RUNLEVEL_COMPILETIME) and manually injects the necessary dependencies of this request handler.

void
shutdown(string $runlevel)

Starts the shutdown sequence

Details

__construct(Bootstrap $bootstrap)

No description

Parameters

Bootstrap $bootstrap

mixed canHandleRequest()

This request handler can handle CLI requests.

Return Value

mixed

true or an integer > 0 if it can handle the request, otherwise false or an integer < 0

int getPriority()

Returns the priority - how eager the handler is to actually handle the request.

Return Value

int

The priority of the request handler

void handleRequest()

Handles a command line request.

While booting, the Object Manager is not yet available for retrieving the CommandExceptionHandler. For this purpose, possible occurring exceptions at this stage are caught manually and treated the same way the CommandExceptionHandler treats exceptions on itself anyways.

Return Value

void

void exitIfCompiletimeCommandWasNotCalledCorrectly(string $runlevel)

Checks if compile time command was not recognized as such, then runlevel was booted but it turned out that in fact the command is a compile time command.

This happens if the user doesn't specify the full command identifier.

Parameters

string $runlevel

one of the Bootstrap::RUNLEVEL_* constants

Return Value

void

protected void boot(string $runlevel)

Initializes the matching boot sequence depending on the type of the command (RUNLEVEL_RUNTIME or RUNLEVEL_COMPILETIME) and manually injects the necessary dependencies of this request handler.

Parameters

string $runlevel

one of the Bootstrap::RUNLEVEL_* constants

Return Value

void

protected void shutdown(string $runlevel)

Starts the shutdown sequence

Parameters

string $runlevel

one of the Bootstrap::RUNLEVEL_* constants

Return Value

void