public function signIn(array $userDetails) { $pl = new PlayerByUsernamePassword($userDetails['username'], $userDetails['password']); if ($pl->getId()) { $this->setUserId($pl->getId()); $this->commit(); $this->setCookie($userDetails); return array('token' => $this->getKey(), 'access' => $pl->getUserAccess()); } throw new LudoDBUnauthorizedException("Invalid username or password"); }