Menu

## Controller
in package

Controller.php : 35

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

Controller.php : 48

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

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

#### $registeredMethods

Controller.php : 54

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

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

#### $instance

Controller.php : 38
`private static Controller|null $instance = null`

#### $middlewareRegistry

Controller.php : 40
`private MiddlewareRegistry $middlewareRegistry`

#### $request

Controller.php : 42
`private WebRequest $request`

### Methods

#### __call()

Controller.php : 81
`public __call(mixed $method, mixed $args) : mixed`

##### Parameters

$method : mixed
$args : mixed

##### Return values

mixed —

#### __construct()

Controller.php : 74

Controller constructor.

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

##### Parameters

$middleware : array<string|int, mixed> = []

##### Return values

mixed —

#### acceptsMethod()

Controller.php : 135

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()

Controller.php : 0
`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()

Controller.php : 0
`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()

Controller.php : 146

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()

Controller.php : 164

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()

Controller.php : 0
`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()

Controller.php : 62

Returns the Controller instance (Singleton)

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

##### Parameters

$middleware : array<string|int, mixed> = []

##### Return values

Controller —

#### head()

Controller.php : 0
`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

—

#### link()

Controller.php : 0
`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()

Controller.php : 0
`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()

Controller.php : 0
`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()

Controller.php : 0
`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()

Controller.php : 0
`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()

Controller.php : 0
`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()

Controller.php : 0
`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()

Controller.php : 0
`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

—

#### unlink()

Controller.php : 0
`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()

Controller.php : 0
`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()

Controller.php : 0
`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