refactoring

This commit is contained in:
Yuri Kuznetsov
2020-06-30 10:11:26 +03:00
parent 9c6bec3761
commit 10793ebdda
8 changed files with 50 additions and 62 deletions
+10 -1
View File
@@ -73,10 +73,19 @@ class ApplicationState
}
/**
* Get current logged user. If no auth is applied, then system used will be returned.
* Whether any user is initialized. If not logged, it will also return TRUE, meaning the system used is used.
*/
public function hasUser() : bool
{
return $this->container->has('user');
}
/**
* Get current logged user. If no auth is applied, then system user will be returned.
*/
public function getUser() : UserEntity
{
if (!$this->hasUser()) throw new Error("User is not available yet.");
return $this->container->get('user');
}