SlaxWeb Framework
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | Protected Attributes | List of all members
SlaxWeb\Router\Route Class Reference

Public Member Functions

 set (string $uri, int $method, callable $action, bool $default=false)
 
 set404Route (callable $action)
 
 setHook (string $hook, bool $after=false)
 

Public Attributes

const METHOD_GET = 0b1
 
const METHOD_POST = 0b10
 
const METHOD_PUT = 0b100
 
const METHOD_DELETE = 0b1000
 
const METHOD_CLI = 0b10000
 
const METHOD_ANY = 0b11111
 

Protected Attributes

 $uri = ""
 
 $method = 0b0
 
 $action = null
 
 $isDefault = false
 
 $is404 = false
 
 $beforeDispatch = ""
 
 $afterDispatch = ""
 
 $_getSetPrepend = ""
 

Member Function Documentation

SlaxWeb\Router\Route::set ( string  $uri,
int  $method,
callable  $action,
bool  $default = false 
)

Set Route data

Sets the retrieved data to internal properties. Prior to setting, the method is checked, that it is valid, and raises an 'InvalidMethodException' on error.

Parameters
string$uriRequest URI regex without delimiter
int$methodHTTP Request Method, accepts METHODO_* constant
callable$actionRoute action
bool$defaultShould the route be marked as default. Default bool(false)
Returns
self
SlaxWeb\Router\Route::set404Route ( callable  $action)

Set 404 Route

Sets the '404NoRouteFound' Route to its properties. This Route is used by the Dispatcher if it can not find a matching Route for its Request.

Parameters
callable$actionRoute action
Returns
self
SlaxWeb\Router\Route::setHook ( string  $hook,
bool  $after = false 
)

Set hook

Sets a hook name for the before or after dispatch hook name to be executed before or after the Route has been dispatched. Takes the name of the hook as the first argument, and a bool value as the second. If ommited or set to false, the hook name will be used before dispatch event, and after dispatch event if set to true.

Parameters
string$hookName of the hook to be executed
bool$afterDefines if the hook is to be executed before or after dispatch, default bool(false)
Returns
self

Member Data Documentation

const SlaxWeb\Router\Route::METHOD_ANY = 0b11111

Any Method

const SlaxWeb\Router\Route::METHOD_CLI = 0b10000

Method Command Line Interface

const SlaxWeb\Router\Route::METHOD_DELETE = 0b1000

Method DELETE

const SlaxWeb\Router\Route::METHOD_GET = 0b1

Method GET

const SlaxWeb\Router\Route::METHOD_POST = 0b10

Method POST

const SlaxWeb\Router\Route::METHOD_PUT = 0b100

Method PUT


The documentation for this class was generated from the following file: