success = $success; $this->errorCode = $errorCode; $this->errorMessage = $errorMessage; $this->retryable = $retryable; } public function isSuccess(): bool { return $this->success; } public function getErrorCode(): ?string { return $this->errorCode; } public function getErrorMessage(): ?string { return $this->errorMessage; } public function isRetryable(): bool { return $this->retryable; } /** * Create a success result. * * @return self */ public static function createSuccess(): self { return new self(true); } /** * Create a failure result. * * @param string $errorCode * @param string $errorMessage * @param bool $retryable * @return self */ public static function createFailure( string $errorCode, string $errorMessage, bool $retryable ): self { return new self(false, $errorCode, $errorMessage, $retryable); } }