Skip to content

User_withValues

Strongbeard edited this page Nov 28, 2014 · 2 revisions

withValues

USER

Summary

Constructor that builds a new user from the provided parameters. It attempts to insert the user into the database. If it succeeds, the $inDB flag is set to true, otherwise it is set to false.

Synopsis

USER::withValues( string $email, string $password, bool $isStudent, bool $isTA, bool $isTutor, bool $isAdmin, string $firstName, string $lastName );

Parameters

  • $email = String. User email address.
  • $password = String. Password in plain-text. The constructor will encrypt it for storage.
  • $isStudent = Boolean. Optional. Specifies if user is a student or not. Used to determine what content to show the user.
  • $isTA = Boolean. Optional. Specifies if user is a TA or not. Used to determine what content to show the user.
  • $isTutor = Boolean. Optional. Specifies if user is a private Tutor or not. Used to determine what content to show the user.
  • $isAdmin = Boolean. Optional. Specifies if user is a system admin or not. Allows the users to access tools to directly edit the site's data.
  • $firstName = Boolean. Optional. User's first name.
  • $lastName = Boolean. Optional. User's last name.

Returns

Instance of the User class or null on failure.

Exceptions

  • InvalidArgumentException = The email address is incorrectly formatted, the password is too short (must be at least 8 characters long), the boolean flags aren't boolean values, and/or the firstname/lastname aren't strings.
Clone this wiki locally