◆ __construct()
__construct |
( |
string |
$trails_root, |
|
|
string |
$trails_uri, |
|
|
string |
$default_controller |
|
) |
| |
- Parameters
-
string | $trails_root | absolute file path to a directory containing the applications controllers, views etc. |
string | $trails_uri | the URI to which routes to mapped Controller/Actions are appended |
string | $default_controller | the route to a controller, that is used if no controller is given, that is the route is equal to '/' |
◆ clean_request_uri()
clean_request_uri |
( |
|
$uri | ) |
|
Clean up URI string by removing the query part and leading slashes.
- Parameters
-
- Returns
- string the cleaned string
◆ default_route()
- Returns
- array an array containing the default controller and an empty unconsumed route
- Exceptions
-
◆ dispatch()
Maps a string to a response which is then rendered.
- Parameters
-
string | $uri | The requested URI. |
◆ error_handler()
error_handler |
( |
|
$errno, |
|
|
|
$string, |
|
|
|
$file, |
|
|
|
$line |
|
) |
| |
This method transforms E_USER_* and E_RECOVERABLE_ERROR to Exceptions.
- Parameters
-
integer | $errno | the level of the error raised |
string | $string | the error message |
string | $file | the filename that the error was raised in |
integer | $line | the line number the error was raised at |
- Returns
- bool
- Exceptions
-
◆ file_exists()
◆ load_controller()
load_controller |
( |
|
$controller | ) |
|
Loads the controller file for a given controller path and return an instance of that controller. If an error occures, an exception will be thrown.
- Parameters
-
string | $controller | the relative controller path |
- Returns
- Controller an instance of that controller
- Exceptions
-
◆ map_uri_to_response()
map_uri_to_response |
( |
|
$uri | ) |
|
Maps an URI to a response by figuring out first what controller to instantiate, then delegating the unconsumed part of the URI to the controller who returns an appropriate response object or throws an Exception.
- Parameters
-
- Returns
- Response a response object
◆ parse()
parse |
( |
|
$unconsumed, |
|
|
|
$controller = null |
|
) |
| |
- Parameters
-
string | $unconsumed | |
string | $controller | |
- Returns
- array
- Exceptions
-
◆ split_on_first_slash()
split_on_first_slash |
( |
|
$str | ) |
|
◆ trails_error()
trails_error |
( |
|
$exception | ) |
|
◆ $default_controller
string $default_controller |
This variable contains the route to the default controller.
◆ $trails_root
This is the absolute file path to the trails application directory.
◆ $trails_uri
This is the URI to which routes to controller/actions are appended.
The documentation for this class was generated from the following file: