email; } public function setEmail(string $email): User { $this->email = $email; return $this; } public function getPassword(): string { return $this->password; } public function setPassword(string $password): User { $this->password = $password; return $this; } public function getName(): string { return $this->name; } public function setName(string $name): User { $this->name = $name; return $this; } /** * @param array $props Properties of the User model * @return User */ public static function fromArray(array $props): User { $user = new self($props['email'], $props['password'], $props['name']); if (isset($props['id'])) { $user->setId($props['id']); } if (isset($props['createdAt'])) { if (is_string($props['createdAt'])) { $props['createdAt'] = new DateTimeImmutable($props['createdAt']); } $user->setCreatedAt($props['createdAt']); } if (isset($props['updatedAt'])) { if (is_string($props['updatedAt'])) { $props['updatedAt'] = new DateTime($props['updatedAt']); } $user->setUpdatedAt($props['updatedAt']); } return $user; } }