ControllerAbstract
Table of Contents
- $action : string
- $area : string
- $DIContainer : ContainerInterface
- $language : object
- $languages : object
- $needsAuthentication : bool
- $request : ServerRequestInterface
- $response : ResponseInterface
- $routeParameters : object
- __construct() : mixed
- Constructor
- __invoke() : ResponseInterface
- Get invoked by request handler
- checkAtLeastOnePermission() : bool
- Checks whether current user has at least one permission among one set
- checkPermission() : bool
- Checks whether current user has a certain permission
- checkRouteParameters() : mixed
- Checks mandatory route parameters
- doBeforeActionExecution() : mixed
- Performs some operations before action execution
- getAuthenticatedUserData() : mixed
- Return authenticated user data (if any)
- handleActionExecution() : mixed
- Handles action execution
- initTraits() : mixed
- Inits used traits searching for magic method __initTrait[trait-name]
- isAuthenticated() : bool
- Checks if user is currently authenticated
- loadLanguages() : mixed
- Loads configured language
- output() : mixed
- Outputs
- redirect() : mixed
- Redirects to a route
- setLanguage() : mixed
- Gets & sets language
- storeRequest() : mixed
- Stores request and related informations
- verifyAuthentication() : bool
- Checks if authenticaion is needed and is valid
Properties
$action
protected
string
$action
$area
protected
string
$area
$DIContainer
protected
ContainerInterface
$DIContainer
$language
protected
object
$language
$languages
protected
object
$languages
= null
$needsAuthentication
protected
bool
$needsAuthentication
= false
$request
protected
ServerRequestInterface
$request
$response
protected
ResponseInterface
$response
$routeParameters
protected
object
$routeParameters
Methods
__construct()
Constructor
public
__construct(ContainerInterface $DIContainer, ResponseInterface $response) : mixed
Parameters
- $DIContainer : ContainerInterface
- $response : ResponseInterface
Return values
mixed —__invoke()
Get invoked by request handler
public
__invoke(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $handler : RequestHandlerInterface
Return values
ResponseInterface —checkAtLeastOnePermission()
Checks whether current user has at least one permission among one set
protected
checkAtLeastOnePermission(array<string|int, mixed> $permissions) : bool
Parameters
- $permissions : array<string|int, mixed>
Return values
bool —checkPermission()
Checks whether current user has a certain permission
protected
checkPermission(string $permission) : bool
Parameters
- $permission : string
Return values
bool —checkRouteParameters()
Checks mandatory route parameters
protected
checkRouteParameters(array<string|int, mixed> $mandatoryParameters) : mixed
Parameters
- $mandatoryParameters : array<string|int, mixed>
-
array of mandatory parameters to be searched into $this->routeParameters
Return values
mixed —doBeforeActionExecution()
Performs some operations before action execution
protected
doBeforeActionExecution(ServerRequestInterface $request) : mixed
Parameters
- $request : ServerRequestInterface
Return values
mixed —getAuthenticatedUserData()
Return authenticated user data (if any)
protected
getAuthenticatedUserData() : mixed
Return values
mixed —object with user data | null
handleActionExecution()
Handles action execution
protected
handleActionExecution() : mixed
Return values
mixed —initTraits()
Inits used traits searching for magic method __initTrait[trait-name]
protected
initTraits() : mixed
Return values
mixed —isAuthenticated()
Checks if user is currently authenticated
protected
isAuthenticated() : bool
Return values
bool —loadLanguages()
Loads configured language
protected
loadLanguages() : mixed
Return values
mixed —output()
Outputs
protected
output(string $contentType, string $content) : mixed
Parameters
- $contentType : string
- $content : string
Return values
mixed —redirect()
Redirects to a route
protected
redirect(string $route) : mixed
Parameters
- $route : string
Return values
mixed —setLanguage()
Gets & sets language
protected
setLanguage([mixed $languageCode = null ]) : mixed
Parameters
- $languageCode : mixed = null
Return values
mixed —storeRequest()
Stores request and related informations
protected
storeRequest(ServerRequestInterface $request) : mixed
Parameters
- $request : ServerRequestInterface
Return values
mixed —verifyAuthentication()
Checks if authenticaion is needed and is valid
protected
verifyAuthentication() : bool