diff options
Diffstat (limited to 'Core/SecurityContext.php')
-rw-r--r-- | Core/SecurityContext.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Core/SecurityContext.php b/Core/SecurityContext.php index 0623140..12eedd1 100644 --- a/Core/SecurityContext.php +++ b/Core/SecurityContext.php @@ -91,4 +91,18 @@ class SecurityContext implements SecurityContextInterface { $this->token = $token; } + + /** + * Returns the current user, if one exists. + * + * @return mixed Returns either an object which implements __toString(), + * or a primitive string if there is a token, otherwise + * returns null. + */ + public function getUser() + { + if ($this->token) { + return $this->token->getUser(); + } + } } |