Jelix 1.8.13

CoordinatorForTest extends jCoordinator
in package

the main class of the jelix core.

this is the "chief orchestra" of the framework. Its goal is to load the configuration, to get the request parameters used to instancie the correspondant controllers and to run the right method.

Tags

Table of Contents

$action  : jSelectorAct
the selector of the current action.
$actionName  : string
the current action name.
$moduleName  : string
the current module name.
$originalAction  : jSelectorAct
the original action when there is an internal redirection to an action different from the one corresponding to the request.
$plugins  : array<string|int, mixed>
plugin list.
$request  : jRequest
current request object.
$response  : jResponse
current response object.
$errorMessage  : jLogErrorMessage
the current error message.
$urlActionMapper  : UrlActionMapper
__clone()  : mixed
__construct()  : mixed
errorHandler()  : mixed
Error handler using a response object to return the error.
exceptionHandler()  : mixed
Exception handler using a response object to return the error Replace the default PHP Exception handler.
execOriginalAction()  : bool
says if the currently executed action is the original one.
getErrorMessage()  : jLogErrorMessage
getGenericErrorMessage()  : string
return the generic error message (errorMessage in the configuration).
getHttpErrorResponse()  : jResponseHtml|jResponseText
Create a response object to show an HTTP error (404, 403...).
getPlugin()  : jICoordPlugin
gets a given coordinator plugin if registered.
getPluginConf()  : array<string|int, mixed>
return the configuration of a plugin for the coordinator.
getUrlActionMapper()  : mixed
handleError()  : mixed
Handle an error event. Called by error handler and exception handler.
isPluginEnabled()  : bool
Says if the given coordinator plugin $name is enabled.
process()  : mixed
main method : launch the execution of the action.
setUrlActionMapper()  : mixed
testSetRequest()  : mixed
getController()  : jController
get the controller corresponding to the selector.
setRequest()  : mixed
initialize the given request and some properties of the coordinator.
_loadPlugins()  : mixed
load the plugins and their configuration file.

Properties

$originalAction

the original action when there is an internal redirection to an action different from the one corresponding to the request.

public jSelectorAct $originalAction
Tags

Methods

__construct()

public __construct([mixed $configFile = '' ][, bool $enableErrorHandler = true ]) : mixed
Parameters
$configFile : mixed = ''
$enableErrorHandler : bool = true

enable the error handler of jelix. keep it to true, unless you have something to debug and really have to use the default handler or an other handler

Tags
Return values
mixed

errorHandler()

Error handler using a response object to return the error.

public errorHandler(int $errno, string $errmsg, string $filename, int $linenum) : mixed

Replace the default PHP error handler.

Parameters
$errno : int

error code

$errmsg : string

error message

$filename : string

filename where the error appears

$linenum : int

line number where the error appears

Tags
since
1.4
Return values
mixed

exceptionHandler()

Exception handler using a response object to return the error Replace the default PHP Exception handler.

public exceptionHandler(Exception|Throwable $e) : mixed
Parameters
$e : Exception|Throwable

the exception object

Tags
since
1.4
Return values
mixed

execOriginalAction()

says if the currently executed action is the original one.

public execOriginalAction() : bool
Tags
Return values
bool

true if yes

getGenericErrorMessage()

return the generic error message (errorMessage in the configuration).

public getGenericErrorMessage() : string

Replaced the %code% pattern in the message by the current error code.

Tags
Return values
string

getHttpErrorResponse()

Create a response object to show an HTTP error (404, 403...).

public getHttpErrorResponse(int $httpCode, string $httpMessage, string $errorDetails) : jResponseHtml|jResponseText
Parameters
$httpCode : int

the http code

$httpMessage : string

the http message

$errorDetails : string

reason or details of the error

Tags
Return values
jResponseHtml|jResponseText

getPlugin()

gets a given coordinator plugin if registered.

public getPlugin(string $pluginName[, bool $required = true ]) : jICoordPlugin
Parameters
$pluginName : string

the name of the plugin

$required : bool = true

says if the plugin is required or not. If true, will generate an exception if the plugin is not registered.

Tags
throws
jException
Return values
jICoordPlugin

getPluginConf()

return the configuration of a plugin for the coordinator.

public static getPluginConf(string $pluginName) : array<string|int, mixed>

This is the content of the configuration file of the plugin if it is given, or the content of the section <pluginname> from the main configuration or the content of the section coordplugin_<pluginname> from the main configuration

The plugin configuration file can be merged with the section <pluginname> or coordplugin_<pluginname> if there is a <pluginname>.mergeconfig parameter in the coordplugins section.

Parameters
$pluginName : string
Tags
throws
Exception

when the configuration filename is not found

Return values
array<string|int, mixed>

the configuration. May be empty if the plugin is unknown

getUrlActionMapper()

public getUrlActionMapper() : mixed
Tags
Return values
mixed

handleError()

Handle an error event. Called by error handler and exception handler.

public handleError(string $type, int $code, string $message, string $file, int $line, array<string|int, mixed> $trace) : mixed
Parameters
$type : string

error type : 'error', 'warning', 'notice'

$code : int

error code

$message : string

error message

$file : string

the file name where the error appear

$line : int

the line number where the error appear

$trace : array<string|int, mixed>

the stack trace

Tags
since
1.1
Return values
mixed

isPluginEnabled()

Says if the given coordinator plugin $name is enabled.

public isPluginEnabled(string $pluginName) : bool
Parameters
$pluginName : string
Tags
Return values
bool

true : plugin is ok

process()

main method : launch the execution of the action.

public process([jRequest $request = null ]) : mixed

This method should be called in a entry point.

Parameters
$request : jRequest = null

the request object. It is required if a descendant of jCoordinator did not called setRequest before

Tags
throws
jException
Return values
mixed

testSetRequest()

public testSetRequest(mixed $request) : mixed
Parameters
$request : mixed
Tags
Return values
mixed

setRequest()

initialize the given request and some properties of the coordinator.

protected setRequest(jRequest $request) : mixed

It extracts information for the request to set the module name and the action name. It doesn't verify if the corresponding controller does exist or not. It enables also the error handler of Jelix, if needed. Does not call this method directly in entry points. Prefer to call process() instead (that will call setRequest). setRequest is mostly used for tests or specific contexts.

Parameters
$request : jRequest

the request object

Tags
throws
jException

if the module is unknown or the action name format is not valid

see
jCoordinator::process()
Return values
mixed

_loadPlugins()

load the plugins and their configuration file.

private _loadPlugins() : mixed
Tags
Return values
mixed

Search results