backend-01

ref: master

app/models/User.php


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

require_once __DIR__ . '/Base.php';

class User extends Base {
  private $userName;
  private $email;
  private $encryptedPassword;

  public function __construct($id, $userName, $email, $encryptedPassword) {
    $this->id = $id;
    $this->userName = $userName;
    $this->email = $email;
    $this->encryptedPassword = $encryptedPassword;
  }

  public function validatePassword($password) {
    return password_verify($password, $this->encryptedPassword);
  }

  public function getId() {
    return $this->id;
  }

  public function getUserName() {
    return $this->userName;
  }

  public function getEmail() {
    return $this->email;
  }

  public function getEncryptedPassword() {
    return $this->encryptedPassword;
  }
}