message = $message; $this->failReason = $failReason; $this->token = $token; $this->view = $view; $this->loggedUser = $loggedUser; } public static function fromNothing() : self { return new self(); } public static function fromFailReason(string $failReason) : self { return new self(null, $failReason); } public static function fromMessage(string $message) : self { return new self($message); } public static function fromArray(array $data) : self { return new self( $data['message'] ?? null, $data['failReason'] ?? null, $data['token'] ?? null, $data['view'] ?? null, $data['loggedUser'] ?? null ); } public function getLoggedUser() : ?User { return $this->loggedUser; } public function getStatus() : string { return $this->status; } public function getView() : ?string { return $this->view; } public function getMessage() : ?string { return $this->message; } public function getToken() : ?string { return $this->token; } public function getFailReason() : ?string { return $this->failReason; } }