original_string: public static function item_for_json($item, $endpoint, $typeid) {
  
          $lineitem = new \stdClass();
          if (is_null($typeid)) {
              $typeidstring = "";
          } else {
              $typeidstring = "?type_id={$typeid}";
          }
          $lineitem->id = "{$endpoint}/{$item->id}/lineitem" . $typeidstring;
          $lineitem->label = $item->itemname;
          $lineitem->scoreMaximum = floatval($item->grademax);
          $lineitem->resourceId = (!empty($item->idnumber)) ? $item->idnumber : '';
          $gbs = self::find_ltiservice_gradebookservice_for_lineitem($item->id);
          if ($gbs) {
              $lineitem->tag = (!empty($gbs->tag)) ? $gbs->tag : '';
              if (isset($gbs->ltilinkid)) {
                  $lineitem->ltiLinkId = strval($gbs->ltilinkid);
              }
          } else {
              $lineitem->tag = '';
              if (isset($item->iteminstance)) {
                  $lineitem->ltiLinkId = strval($item->iteminstance);
              }
          }
  
          return $lineitem;
  
      }
code: public static function item_for_json($item, $endpoint, $typeid) {
  
          $lineitem = new \stdClass();
          if (is_null($typeid)) {
              $typeidstring = "";
          } else {
              $typeidstring = "?type_id={$typeid}";
          }
          $lineitem->id = "{$endpoint}/{$item->id}/lineitem" . $typeidstring;
          $lineitem->label = $item->itemname;
          $lineitem->scoreMaximum = floatval($item->grademax);
          $lineitem->resourceId = (!empty($item->idnumber)) ? $item->idnumber : '';
          $gbs = self::find_ltiservice_gradebookservice_for_lineitem($item->id);
          if ($gbs) {
              $lineitem->tag = (!empty($gbs->tag)) ? $gbs->tag : '';
              if (isset($gbs->ltilinkid)) {
                  $lineitem->ltiLinkId = strval($gbs->ltilinkid);
              }
          } else {
              $lineitem->tag = '';
              if (isset($item->iteminstance)) {
                  $lineitem->ltiLinkId = strval($item->iteminstance);
              }
          }
  
          return $lineitem;
  
      }
code_tokens: public static function item_for_json ( $ item , $ endpoint , $ typeid ) { $ lineitem = new \ stdClass ( ) ; if ( is_null ( $ typeid ) ) { $ typeidstring = "" ; } else { $ typeidstring = "?type_id={$typeid}" ; } $ lineitem -> id = "{$endpoint}/{$item->id}/lineitem" . $ typeidstring ; $ lineitem -> label = $ item -> itemname ; $ lineitem -> scoreMaximum = floatval ( $ item -> grademax ) ; $ lineitem -> resourceId = ( ! empty ( $ item -> idnumber ) ) ? $ item -> idnumber : '' ; $ gbs = self :: find_ltiservice_gradebookservice_for_lineitem ( $ item -> id ) ; if ( $ gbs ) { $ lineitem -> tag = ( ! empty ( $ gbs -> tag ) ) ? $ gbs -> tag : '' ; if ( isset ( $ gbs -> ltilinkid ) ) { $ lineitem -> ltiLinkId = strval ( $ gbs -> ltilinkid ) ; } } else { $ lineitem -> tag = '' ; if ( isset ( $ item -> iteminstance ) ) { $ lineitem -> ltiLinkId = strval ( $ item -> iteminstance ) ; } } return $ lineitem ; }
docstring: Get the json object representation of the grade item
  
  @param object $item Grade Item record
  @param string $endpoint Endpoint for lineitems container request
  @param string $typeid
  
  @return object
docstring_tokens: Get the json object representation of the grade item