Snaju Inception Docs

Controller

Convenience class for organizing blocks of code according to the request method that should trigger the scoped block of code.

Table of Contents

$globalRouteMiddleware  : array<string|int, mixed>
The middleware that shoud be ran on every method for the route.
$registeredMethods  : array<string|int, mixed>
The methods that the Controller has a registered callable for and won't run the fallback method for.
$instance  : Controller|null
$middlewareRegistry  : MiddlewareRegistry
$request  : WebRequest
__call()  : mixed
__construct()  : mixed
Controller constructor.
acceptsMethod()  : bool
Convenience method that checks if the controller has a registered callable for the specified request method.
copy()  :
delete()  :
execute()  : void
Process the code starting with execution of "before" middleware, the core (i.e.: route), followed by any "after" middleware.
fallback()  : void
Accepts and executes a closure when a request uses a method that hasn't been "registered," will not get triggered if a request method matches __call magic method.
get()  :
getInstance()  : Controller
Returns the Controller instance (Singleton)
head()  :
link()  :
lock()  :
options()  :
patch()  :
post()  :
propfind()  :
purge()  :
put()  :
unlink()  :
unlock()  :
view()  :

Properties

$globalRouteMiddleware

The middleware that shoud be ran on every method for the route.

public array<string|int, mixed> $globalRouteMiddleware = []

$registeredMethods

The methods that the Controller has a registered callable for and won't run the fallback method for.

public array<string|int, mixed> $registeredMethods = []

Methods

__call()

public __call(mixed $method, mixed $args) : mixed
Parameters
$method : mixed
$args : mixed
Return values
mixed

__construct()

Controller constructor.

public __construct([array<string|int, mixed> $middleware = [] ]) : mixed
Parameters
$middleware : array<string|int, mixed> = []
Return values
mixed

acceptsMethod()

Convenience method that checks if the controller has a registered callable for the specified request method.

public acceptsMethod(string $method) : bool
Parameters
$method : string
Return values
bool

copy()

public copy(Closure $func, array<string|int, mixed> $middleware = []) :

Handle COPY requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values

delete()

public delete(Closure $func, array<string|int, mixed> $middleware = []) :

Handle DELETE requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values

execute()

Process the code starting with execution of "before" middleware, the core (i.e.: route), followed by any "after" middleware.

public execute(Closure $func) : void
Parameters
$func : Closure
Return values
void

fallback()

Accepts and executes a closure when a request uses a method that hasn't been "registered," will not get triggered if a request method matches __call magic method.

public fallback(Closure $func) : void
Parameters
$func : Closure
Return values
void

get()

public get(Closure $func, array<string|int, mixed> $middleware = []) :

Handle GET requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values

getInstance()

Returns the Controller instance (Singleton)

public static getInstance([array<string|int, mixed> $middleware = [] ]) : Controller
Parameters
$middleware : array<string|int, mixed> = []
Return values
Controller

head()

public head(Closure $func, array<string|int, mixed> $middleware = []) :

Handle HEAD requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values
public link(Closure $func, array<string|int, mixed> $middleware = []) :

Handle LINK requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values

lock()

public lock(Closure $func, array<string|int, mixed> $middleware = []) :

Handle LOCK requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values

options()

public options(Closure $func, array<string|int, mixed> $middleware = []) :

Handle OPTIONS requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values

patch()

public patch(Closure $func, array<string|int, mixed> $middleware = []) :

Handle PATCH requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values

post()

public post(Closure $func, array<string|int, mixed> $middleware = []) :

Handle POST requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values

propfind()

public propfind(Closure $func, array<string|int, mixed> $middleware = []) :

Handle PROPFIND requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values

purge()

public purge(Closure $func, array<string|int, mixed> $middleware = []) :

Handle PURGE requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values

put()

public put(Closure $func, array<string|int, mixed> $middleware = []) :

Handle PUT requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values
public unlink(Closure $func, array<string|int, mixed> $middleware = []) :

Handle UNLINK requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values

unlock()

public unlock(Closure $func, array<string|int, mixed> $middleware = []) :

Handle UNLOCK requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values

view()

public view(Closure $func, array<string|int, mixed> $middleware = []) :

Handle VIEW requests from a client.

Parameters
$func : Closure
$middleware = [] : array<string|int, mixed>
Return values

Search results