ZubZet
in package
Uses
Router, Configuration, CanRetrieveModel, ExceptionBehavior, CanRetrieveBooterSettings
Table of Contents
- $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
- Parses all the options as variables, instantiates the z_db, and establishes the db connection.
- execute() : mixed
- executeControllerAction() : mixed
- executePath() : mixed
- Executes an action for a specified path
- getBooterSettings() : mixed
- Gets a booter setting
- getModel() : Model
- Returns a model
- 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.
- 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
$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()
Parses all the options as variables, instantiates the z_db, and establishes the db connection.
public
__construct([array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $params : array<string|int, mixed> = []
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
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 $key = null ][, mixed $useDefault = true ][, mixed $default = null ]) : mixed
Parameters
- $key : string = null
-
Key of the setting
- $useDefault : mixed = true
- $default : mixed = null
Return values
mixed —Value of the key
getModel()
Returns a model
public
getModel(string $model[, string $dir = null ]) : Model
Parameters
- $model : string
-
Name of the model
- $dir : string = null
-
Set this when the model is stored in a specific directory
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.
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.