email = $email; $this->password = $password; $this->name; } public function getEmail(): string { return $this->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->id; } /** * @param string[] $props Properties of the User model * @return User */ public static function fromArray(array $props): User { return new self( $props['id'] ?? null, $props['email'], $props['password'], $props['name'] ); } }