RecordingFramework
extends ZubZet
in package
Table of Contents
- $dispatched : array<string|int, mixed>
- $maxReroutes : int
- $req : Request
- $requestStack : array<string|int, mixed>
- $reroutes : int
- $res : Response
- $responseStack : array<string|int, mixed>
- $user : User
- $z_db : Connection
- $routeDispatcher : Dispatcher|null
- __construct() : mixed
- Boots the framework and instantiates the z_db proxy, which connects to the database lazily.
- execute() : mixed
- executeControllerAction() : mixed
- executePath() : mixed
- Executes an action for a specified path Maps [<name>, <action>] to <Name>Controller::action_<action> (defaultIndex controller / action_index when missing), overwrites request()->urlParts and dies once more than $maxReroutes calls were made. Returns nothing.
- getBooterSettings() : mixed
- Gets a booter setting
- getModel() : Model
- Returns a model, one shared instance per request; falls back to the framework models when not found
- loadConfiguration() : mixed
- replaceRequest() : mixed
- reroute() : void
- Tries to reroute the request using FastRoute first, if the route does not exist, it falls back to the ZubZet framework. It replaces the current request state (path and args) via replaceRequest, executes the new route and then returns to the caller, which keeps running.
- setExceptionBehavior() : void
- setRequestResponse() : mixed
- classifyErrorSeverity() : array<string|int, mixed>
- getRouteDispatcher() : Dispatcher
- logError() : void
- registerExceptionHandler() : void
- Logs uncaught throwables and dispatches rendering. When Whoops is active we invoke it directly so it receives the full throwable — re-throwing hands off to PHP's default fatal display, after which Whoops only sees the tail via `handleShutdown()` and loses every vendor/framework frame.
Properties
$dispatched
public
array<string|int, mixed>
$dispatched
= []
$maxReroutes
public
int
$maxReroutes
= 10
Number of reroutes the controller can perform before aborting
$req
public
Request
$req
A reference to an instance of the current Request class
$requestStack
public
array<string|int, mixed>
$requestStack
= []
$reroutes
public
int
$reroutes
= 0
Number of times this request was rerouted
$res
public
Response
$res
A reference to an instance of the current Response class
$responseStack
public
array<string|int, mixed>
$responseStack
= []
$user
public
User
$user
The requesting user
$z_db
public
Connection
$z_db
Database proxy object
$routeDispatcher
private
Dispatcher|null
$routeDispatcher
= null
Methods
__construct()
Boots the framework and instantiates the z_db proxy, which connects to the database lazily.
public
__construct([array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $params : array<string|int, mixed> = []
-
Overrides settings that already exist in the configuration file.
Return values
mixed —execute()
public
execute([array<string|int, mixed>|null $customUrlParts = null ]) : mixed
Parameters
- $customUrlParts : array<string|int, mixed>|null = null
Return values
mixed —executeControllerAction()
public
executeControllerAction(mixed $controller, mixed $action[, array<string|int, mixed> $params = [] ][, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
- $controller : mixed
- $action : mixed
- $params : array<string|int, mixed> = []
- $arguments : array<string|int, mixed> = []
Return values
mixed —executePath()
Executes an action for a specified path Maps [<name>, <action>] to <Name>Controller::action_<action> (defaultIndex controller / action_index when missing), overwrites request()->urlParts and dies once more than $maxReroutes calls were made. Returns nothing.
public
executePath(array<string|int, mixed> $parts) : mixed
Parameters
- $parts : array<string|int, mixed>
-
Example: ["auth", "login"]
Return values
mixed —getBooterSettings()
Gets a booter setting
public
getBooterSettings([string|null $key = null ][, bool $useDefault = true ][, mixed $default = null ]) : mixed
Parameters
- $key : string|null = null
-
Key of the setting, null or empty returns all settings
- $useDefault : bool = true
-
Return $default instead of throwing when the key does not exist
- $default : mixed = null
-
Value returned for a missing key when $useDefault is true
Tags
Return values
mixed —Value of the key
getModel()
Returns a model, one shared instance per request; falls back to the framework models when not found
public
getModel(string $model[, string|null $dir = null ]) : Model
Parameters
- $model : string
-
Name of the model, sub-folders dot separated (e.g. "admin.User")
- $dir : string|null = null
-
Set this when the model is stored in a specific directory, needs a trailing slash
Tags
Return values
Model —The model
loadConfiguration()
public
loadConfiguration(string $frameworkRoot, array<string|int, mixed> $params) : mixed
Parameters
- $frameworkRoot : string
- $params : array<string|int, mixed>
Return values
mixed —replaceRequest()
public
replaceRequest(State $newState) : mixed
Parameters
- $newState : State
Return values
mixed —reroute()
Tries to reroute the request using FastRoute first, if the route does not exist, it falls back to the ZubZet framework. It replaces the current request state (path and args) via replaceRequest, executes the new route and then returns to the caller, which keeps running.
public
reroute(array<string|int, mixed> $parts) : void
Parameters
- $parts : array<string|int, mixed>
-
The parts of the new route. Example: ["auth", "login"]
Return values
void —setExceptionBehavior()
public
setExceptionBehavior([int|null $state = null ]) : void
Parameters
- $state : int|null = null
Return values
void —setRequestResponse()
public
setRequestResponse(Request $request, Response $response) : mixed
Parameters
Return values
mixed —classifyErrorSeverity()
private
static classifyErrorSeverity(int $severity) : array<string|int, mixed>
Parameters
- $severity : int
Return values
array<string|int, mixed> —getRouteDispatcher()
private
getRouteDispatcher() : Dispatcher
Return values
Dispatcher —logError()
private
static logError(int $severity, string $message, string $file, int $line) : void
Parameters
- $severity : int
- $message : string
- $file : string
- $line : int
Return values
void —registerExceptionHandler()
Logs uncaught throwables and dispatches rendering. When Whoops is active we invoke it directly so it receives the full throwable — re-throwing hands off to PHP's default fatal display, after which Whoops only sees the tail via `handleShutdown()` and loses every vendor/framework frame.
private
static registerExceptionHandler() : void
Do NOT pair this with restore_exception_handler(): on PHP >= 8.3
the combination recurses on the re-thrown throwable until
zend.max_allowed_stack_size trips.