class Controller extends Application

This is the parent Controller class. It describes functions that are available to all classes that extends this Controller class.

Properties

protected string $_action

The name of the current action.

protected string $_controller

The name of the current controller.

Input $request

Instance of Input class that performs much of our request tasks.

View $view

Instance of view class.

Methods

__construct(string $controller, string $action)

Constructor for the parent Controller class. This constructor gets called when an instance of the child class is instantiated.

void
logViewForTesting(View $view)

Captures the current View instance during testing so that test assertions (e.g., assertViewContains) can access view-bound variables.

void
onConstruct()

Function implemented by child model classes when models are instantiated.

Details

at line 47
__construct(string $controller, string $action)

Constructor for the parent Controller class. This constructor gets called when an instance of the child class is instantiated.

Parameters

string $controller

The name of the controller obtained while parsing the URL.

string $action

The name of the action specified in the path of the URL.

at line 67
protected void logViewForTesting(View $view)

Captures the current View instance during testing so that test assertions (e.g., assertViewContains) can access view-bound variables.

This method should be called in controller actions before rendering a view. It stores the View object in ApplicationTestCase::$controllerOutput['view'] when the application is running in the 'testing' environment.

Parameters

View $view

The View instance to capture.

Return Value

void

at line 79
void onConstruct()

Function implemented by child model classes when models are instantiated.

Return Value

void