PersoSelector
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- load() : Perso
- Run all the workflow to get a perso.
- selectAndSetPerso() : void
- Select a perso, as a fresh login.
- setPerso() : void
- getDefaultEvents() : array<string|int, BaseEvent>
- Select a perso using several strategies in a sequential order.
- handleEvents() : void
Properties
$db
public
DatabaseEngine
$db
$hasPerso
public
bool
$hasPerso
= false
$perso
public
Perso
$perso
$smarty
public
Smarty
$smarty
$user
public
User
$user
Methods
__construct()
public
__construct(DatabaseEngine $db, User $user, Smarty $smarty) : mixed
Parameters
- $db : DatabaseEngine
- $user : User
-
The currently logged user
- $smarty : Smarty
load()
Run all the workflow to get a perso.
public
static load(DatabaseEngine $db, User $user, Smarty $smarty) : Perso
Parameters
- $db : DatabaseEngine
- $user : User
- $smarty : Smarty
Return values
PersoselectAndSetPerso()
Select a perso, as a fresh login.
public
selectAndSetPerso(Perso $perso) : void
If the perso is already logged in, we can call PersoSelector::setPerso instead.
Parameters
- $perso : Perso
setPerso()
public
setPerso(Perso $perso) : void
Parameters
- $perso : Perso
getDefaultEvents()
Select a perso using several strategies in a sequential order.
private
getDefaultEvents() : array<string|int, BaseEvent>
Order matters: for example, to be able to log a perso out, we first need to select it from the session.
Return values
array<string|int, BaseEvent>handleEvents()
private
handleEvents() : void