\LiftKit\ControllerController

Abstract Controller Class

This class defines an abstraction for a Controller. A controller acts as the gateway between a Request and a the business logic. A Router will execute a Request to determine which Controller action to take. Controller actions should be public methods which return a valid Response object, acting as the glue for an application.

Summary

Methods
Properties
Constants
__construct()
dispatch()
respondsTo()
No public properties found
No constants found
No protected methods found
$container
N/A
No private methods found
No private properties found
N/A

Properties

$container

$container : \LiftKit\DependencyInjection\Container\Container

Dependency injection container

Type

\LiftKit\DependencyInjection\Container\Container

Methods

__construct()

__construct(\LiftKit\DependencyInjection\Container\Container  $container) 

Initializes object

Parameters

\LiftKit\DependencyInjection\Container\Container $container

dispatch()

dispatch(string  $method, array  $args = array()) : \LiftKit\Response\Response

Dispatches a Controller action.

Parameters

string $method

The name of the method to be executed.

array $args

An array of arguments to be passed to the method.

Throws

\LiftKit\Controller\Exception\InvalidResponse
\LiftKit\Controller\Exception\InvalidMethod

Returns

\LiftKit\Response\Response

respondsTo()

respondsTo(string  $method, array  $args = array()) : boolean

Will indicate whether the controller responds to a particular combination of method and arguments.

Parameters

string $method

The name of the method to be executed.

array $args

An array of arguments to be passed to the method.

Returns

boolean —

true if the controller can respond, false if not