$code, 'details' => $details ]; $exceptionData = []; switch ( $code ) { case self::UNEXPECTED_RESPONSE: $exceptionData = [ 'priority' => GateExceptionPriority::HIGH, 'message' => 'Unexpected response.' ]; break; case self::ERROR_RESPONSE: $exceptionData = [ 'priority' => GateExceptionPriority::NORMAL, 'message' => 'Error occurred during the request.' ]; break; case self::NOT_AUTHENTICATED: $exceptionData = [ 'priority' => GateExceptionPriority::HIGH, 'message' => 'Authentication failed.' ]; break; case self::NOT_SUPPORTED: $exceptionData = [ 'priority' => GateExceptionPriority::HIGH, 'message' => 'The method is not supported.', ]; break; } $exceptionData = array_merge($baseData, $exceptionData); return new GateBridgeException($exceptionData); } }