◆ __construct()
- Parameters
-
Dispatcher | $dispatcher | the dispatcher who creates this instance |
◆ after_filter()
after_filter |
( |
|
$action, |
|
|
|
$args |
|
) |
| |
Callback function being called after an action is executed.
- Parameters
-
string | $action | Name of the action to perform. |
array | $args | An array of arguments to the action. |
- Returns
- void
◆ before_filter()
before_filter |
( |
& |
$action, |
|
|
& |
$args |
|
) |
| |
Callback function being called before an action is executed. If this function does not return FALSE, the action will be called, otherwise an error will be generated and processing will be aborted. If this function already #rendered or #redirected, further processing of the action is withheld.
- Parameters
-
string | $action | Name of the action to perform. |
array | $args | An array of arguments to the action. |
- Returns
- bool|void
◆ default_action_and_args()
default_action_and_args |
( |
| ) |
|
Return the default action and arguments
- Returns
- array containing the action, an array of args and the format
◆ does_not_understand()
does_not_understand |
( |
|
$action, |
|
|
|
$args |
|
) |
| |
- Parameters
-
- Returns
- void
- Exceptions
-
◆ erase_response()
Resets the response of the controller
- Returns
- void
◆ extract_action_and_args()
extract_action_and_args |
( |
|
$string | ) |
|
Extracts action and args from a string.
- Parameters
-
string | $string | the processed string |
- Returns
- array an array with two elements - a string containing the action and an array of strings representing the args
◆ get_assigned_variables()
get_assigned_variables |
( |
| ) |
|
This method returns all the set instance variables to be used as attributes for a template. This controller is returned too as value for key 'controller'.
- Returns
- array an associative array of variables for the template
◆ get_default_template()
get_default_template |
( |
|
$action | ) |
|
◆ get_response()
Return this controller's response
- Returns
- Response the controller's response
◆ get_template_factory()
Create and return a template factory for this controller.
- Returns
- Factory
◆ map_action()
Maps the action to an actual method name.
- Parameters
-
- Returns
- array the mapped method name
◆ perform()
This method extracts an action string and further arguments from it's parameter. The action string is mapped to a method being called afterwards using the said arguments. That method is called and a response object is generated, populated and sent back to the dispatcher.
- Parameters
-
- Returns
- Response
- Exceptions
-
◆ redirect()
- Parameters
-
- Returns
- void
- Exceptions
-
◆ render_action()
Renders the template of the given action as the response's body.
- Parameters
-
- Returns
- void
◆ render_nothing()
Renders the empty string as the response's body.
- Returns
- void
- Exceptions
-
◆ render_template()
render_template |
( |
|
$template_name, |
|
|
|
$layout = null |
|
) |
| |
Renders a template using an optional layout template.
- Parameters
-
Template | string | $template_name | a flexi template |
Template | string | null | $layout | a flexi template which is used as layout |
- Returns
- void
- Exceptions
-
DoubleRenderError | |
TemplateNotFoundException | |
◆ render_text()
render_text |
( |
|
$text = ' ' | ) |
|
Renders the given text as the body of the response.
- Parameters
-
string | $text | the text to be rendered |
- Returns
- void
- Exceptions
-
◆ rescue()
Exception handler called when the performance of an action raises an exception.
- Parameters
-
\Throwable | $exception | the thrown exception |
- Returns
- Response a response object
◆ respond_to()
◆ set_content_type()
set_content_type |
( |
|
$type | ) |
|
Sets the content type of the controller's response.
- Parameters
-
string | $type | the content type |
- Returns
- void
◆ set_layout()
Sets the layout to be used by this controller per default.
- Parameters
-
Template | string | null | $layout | a flexi template to be used as layout |
- Returns
- void
◆ set_status()
set_status |
( |
|
$status, |
|
|
|
$reason_phrase = null |
|
) |
| |
◆ url_for()
Returns a URL to a specified route to your Trails application.
Example: Your Trails application is located at 'http://example.com/dispatch.php'. So your dispatcher's trails_uri is set to 'http://example.com/dispatch.php' If you want the URL to your 'wiki' controller with action 'show' and parameter 'page' you should send:
$url = $controller->url_for('wiki/show', 'page');
$url should then contain 'http://example.com/dispatch.php/wiki/show/page'.
The first parameter is a string containing the controller and optionally an action:
- "{controller}/{action}"
- "path/to/controller/action"
- "controller"
This "controller/action" string is not url encoded. You may provide additional parameter which will be urlencoded and concatenated with slashes:
$controller->url_for('wiki/show', 'page');
-> 'wiki/show/page'
$controller->url_for('wiki/show', 'page', 'one and a half');
-> 'wiki/show/page/one+and+a+half'
- Parameters
-
string | $to | a string containing a controller and optionally an action |
- Returns
- string a URL to this route
◆ $dispatcher
◆ $layout
◆ $performed
◆ $response
The documentation for this class was generated from the following file: