\Gishiki\Core\MVC\ControllerController

The Gishiki base controller: every controller inherits from this class

Summary

Methods
Properties
Constants
__construct()
getResponse()
getRequest()
__call()
No public properties found
No constants found
No protected methods found
$request
$response
$arguments
$get
$plugins
$application
N/A
No private methods found
No private properties found
N/A

Properties

$request

$request : \Psr\Http\Message\RequestInterface

This is a clone of the request the client have send to this server.

Type

\Psr\Http\Message\RequestInterface — the request the controller must fulfill

$response

$response : \Psr\Http\Message\ResponseInterface

This is the response that will be sent back to the client from this server.

Type

\Psr\Http\Message\ResponseInterface — the response the controller must generate

$arguments

$arguments : \Gishiki\Algorithms\Collections\GenericCollection

This is the collection of arguments passed to the URI.

Type

\Gishiki\Algorithms\Collections\GenericCollection — the collection of arguments passed to the URI

$get

$get : \Gishiki\Algorithms\Collections\GenericCollection

This is the collection of arguments passed as GET.

Type

\Gishiki\Algorithms\Collections\GenericCollection — the collection of arguments passed as GET

$plugins

$plugins : array

Type

array — an array containing specified plugin collection as instantiated objects

$application

$application : \Gishiki\Core\Application|null

Type

\Gishiki\Core\Application|null — the application current instance

Methods

__construct()

__construct(\Psr\Http\Message\RequestInterface  $controllerRequest, \Psr\Http\Message\ResponseInterface  $controllerResponse, \Gishiki\Algorithms\Collections\GenericCollection  $controllerArguments, array  $plugins, \Gishiki\Core\Application|null  $app = null) 

Create a new controller that will fulfill the given request filling the given response.

Warning: you should never attempt to use another construction in your controllers, unless it calls parent::__construct(), and it doesn't accept arguments

Parameters

\Psr\Http\Message\RequestInterface $controllerRequest

the request arrived from the client

\Psr\Http\Message\ResponseInterface $controllerResponse

the response to be given to the client

\Gishiki\Algorithms\Collections\GenericCollection $controllerArguments

the collection of matched URI params and GET params

array $plugins

the array containing passed plugins

\Gishiki\Core\Application|null $app

the current application instance

Throws

\Gishiki\Core\MVC\Controller\ControllerException

the error preventing the controller creation

getResponse()

getResponse() : \Psr\Http\Message\ResponseInterface

Get the HTTP response.

Returns

\Psr\Http\Message\ResponseInterface —

the HTTP response

getRequest()

getRequest() : \Psr\Http\Message\RequestInterface

Get the HTTP request.

Returns

\Psr\Http\Message\RequestInterface —

the HTTP request

__call()

__call(string  $name, array  $arguments) : mixed

Execute a function of any plugin that has been bind to this controller:

class MyPlugin extends Plugin { public function doSomethingSpecial($arg1, $arg2) {

} }

//inside the controller: $this->doSomethingSpecial($name, $surname);

Parameters

string $name

the name of the called function

array $arguments

the list of passed arguments as an array

Throws

\Gishiki\Core\MVC\Controller\ControllerException

the function doesn't exists in any plugin

Returns

mixed —

the value returned from the function