diff --git a/src/Util/LTI13.php b/src/Util/LTI13.php index ff4d9f1..23bd4b9 100644 --- a/src/Util/LTI13.php +++ b/src/Util/LTI13.php @@ -946,6 +946,10 @@ public static function deleteLineItem($lineitem_url, $access_token, &$debug_log= * @return mixed If this works it returns an array including the new line item url. If it fails, it returns a string. */ public static function createLineItem($lineitems_url, $access_token, $lineitem, &$debug_log = false) { + $scoreMaximum = $lineitem->scoreMaximum ?? 100; + $lineitem->scoreMaximum = is_numeric($scoreMaximum) ? floatval($scoreMaximum) : 100; + if ( ! is_string($lineitem->label ?? null) ) $lineitem->label = strval($lineitem->label ?? null); + if ( ! is_string($lineitem->resourceId ?? null) ) $lineitem->resourceId = strval($lineitem->resourceId ?? null); $lineitems_url = trim($lineitems_url);