/** * Checks that the user is activated * * @param User $user The user * * @return User * * @throws DisabledException if the user is not activated */ private function checkActivatedStatus(User $user) { if (!$user->isActivated()) { throw new DisabledException(sprintf('Account `%s`is disabled.', $user->getUsername())); } return $user; }