/** * Lookup active sessions. * * @return array */ public function getActiveSessions() { // Parse the user-agents to get a user-friendly Browser, version and platform. $parser = UAParser\Parser::create(); $this->repositoryAuthtoken->deleteExpiredTokens(); $sessions = $this->repositoryAuthtoken->getActiveSessions() ?: []; foreach ($sessions as &$session) { $ua = $parser->parse($session->getUseragent()); $session->setBrowser(sprintf('%s / %s', $ua->ua->toString(), $ua->os->toString())); } return $sessions; }