PHP Class System\Route

ファイルを表示 Open project: rwarasaurus/nano Class Usage Examples

Public Properties

Property Type Description
$args array The collected arguments from the uri match
$callbacks array Array of callable functions
$collection array Array of collection actions

Public Methods

Method Description
__callStatic ( $method, $arguments ) Define a route using the method name as the request method to listen for
__construct ( $callbacks, $args = [] ) Create a new instance of the Route class
action ( $name, $callback ) Register a action on the router
after ( $response ) : object | null Calls after actions
before ( ) : object | null Calls before actions
callback ( $name ) : object | null Run actions
collection ( $actions, $definitions ) Start a collection of routes with common actions
not_found ( $callbacks ) Register the 404 not found callback
register ( $method, $patterns, $arguments ) Register a route on the router
run ( ) : object Calls the route actions and returns a response object

Method Details

__callStatic() public static method

Define a route using the method name as the request method to listen for
public static __callStatic ( $method, $arguments )

__construct() public method

Create a new instance of the Route class
public __construct ( $callbacks, $args = [] )

action() public static method

Register a action on the router
public static action ( $name, $callback )

after() public method

Calls after actions
public after ( $response ) : object | null
return object | null

before() public method

Calls before actions
public before ( ) : object | null
return object | null

callback() public method

Run actions
public callback ( $name ) : object | null
return object | null

collection() public static method

Start a collection of routes with common actions
public static collection ( $actions, $definitions )

not_found() public static method

Register the 404 not found callback
public static not_found ( $callbacks )

register() public static method

Register a route on the router
public static register ( $method, $patterns, $arguments )

run() public method

Calls the route actions and returns a response object
public run ( ) : object
return object

Property Details

$args public_oe property

The collected arguments from the uri match
public array $args
return array

$callbacks public_oe property

Array of callable functions
public array $callbacks
return array

$collection public_oe static_oe property

Array of collection actions
public static array $collection
return array