PHP Class Pop\Mvc\Controller

Author: Nick Sagona, III ([email protected])
Afficher le fichier Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Свойство Type Description
$errorAction string Error action
$project Pop\Project\Project Project config object
$request Pop\Http\Request Request
$response Pop\Http\Response Response
$view View View object
$viewPath string View path

Méthodes publiques

Méthode Description
__construct ( Pop\Http\Request $request = null, Pop\Http\Response $response = null, Project $project = null, string $viewPath = null ) : Controller Constructor
dispatch ( string $action = 'index' ) : Controller Dispatch the controller based on the action
getErrorAction ( ) : string Get the error action
getProject ( ) : Project Get the project object
getRequest ( ) : Pop\Http\Request Get the request object
getResponse ( ) : Pop\Http\Response Get the response object
getView ( ) : View Get the view object
getViewPath ( ) : string Get the view path
send ( integer $code = 200, array $headers = null ) : void Finalize the request and send the response.
sendJson ( mixed $values, integer $code = 200, array $headers = null ) : void Method to send a JSON response
setErrorAction ( string $error ) : Controller Set the error action
setProject ( Project $project ) : Controller Set the response object
setRequest ( Pop\Http\Request $request ) : Controller Set the request object
setResponse ( Pop\Http\Response $response ) : Controller Set the response object
setViewPath ( string $viewPath ) : Controller Set the response object

Method Details

__construct() public méthode

Instantiate the controller object
public __construct ( Pop\Http\Request $request = null, Pop\Http\Response $response = null, Project $project = null, string $viewPath = null ) : Controller
$request Pop\Http\Request
$response Pop\Http\Response
$project Pop\Project\Project
$viewPath string
Résultat Controller

dispatch() public méthode

Dispatch the controller based on the action
public dispatch ( string $action = 'index' ) : Controller
$action string
Résultat Controller

getErrorAction() public méthode

Get the error action
public getErrorAction ( ) : string
Résultat string

getProject() public méthode

Get the project object
public getProject ( ) : Project
Résultat Pop\Project\Project

getRequest() public méthode

Get the request object
public getRequest ( ) : Pop\Http\Request
Résultat Pop\Http\Request

getResponse() public méthode

Get the response object
public getResponse ( ) : Pop\Http\Response
Résultat Pop\Http\Response

getView() public méthode

Get the view object
public getView ( ) : View
Résultat View

getViewPath() public méthode

Get the view path
public getViewPath ( ) : string
Résultat string

send() public méthode

Finalize the request and send the response.
public send ( integer $code = 200, array $headers = null ) : void
$code integer
$headers array
Résultat void

sendJson() public méthode

Method to send a JSON response
public sendJson ( mixed $values, integer $code = 200, array $headers = null ) : void
$values mixed
$code integer
$headers array
Résultat void

setErrorAction() public méthode

Set the error action
public setErrorAction ( string $error ) : Controller
$error string
Résultat Controller

setProject() public méthode

Set the response object
public setProject ( Project $project ) : Controller
$project Pop\Project\Project
Résultat Controller

setRequest() public méthode

Set the request object
public setRequest ( Pop\Http\Request $request ) : Controller
$request Pop\Http\Request
Résultat Controller

setResponse() public méthode

Set the response object
public setResponse ( Pop\Http\Response $response ) : Controller
$response Pop\Http\Response
Résultat Controller

setViewPath() public méthode

Set the response object
public setViewPath ( string $viewPath ) : Controller
$viewPath string
Résultat Controller

Property Details

$errorAction protected_oe property

Error action
protected string $errorAction
Résultat string

$project protected_oe property

Project config object
protected Project,Pop\Project $project
Résultat Pop\Project\Project

$request protected_oe property

Request
protected Request,Pop\Http $request
Résultat Pop\Http\Request

$response protected_oe property

Response
protected Response,Pop\Http $response
Résultat Pop\Http\Response

$view protected_oe property

View object
protected View,Pop\Mvc $view
Résultat View

$viewPath protected_oe property

View path
protected string $viewPath
Résultat string