email; } public function getPassword(): string { return $this->password; } public function getName(): string { return $this->name; } /** * If the `id` property exists, we can assume this entity already exists. * * @return bool */ public function isNew(): bool { return (bool) $this->getId(); } /** * @param string[] $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 ($props['id']) { $user->setId($props['id']); } $user->setCreatedAt($props['createdAt']); $user->setUpdatedAt($props['updatedAt']); return $user; } }