Skip to content

Commit

Permalink
Fix types on lineitem request
Browse files Browse the repository at this point in the history
  • Loading branch information
csev committed Nov 14, 2024
1 parent 0e76f6a commit 2b51276
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Util/LTI13.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 2b51276

Please sign in to comment.