original_string: public static function find_ltiservice_gradebookservice_for_lineitem($lineitemid) {
          global $DB;
  
          if (!$lineitemid) {
              return false;
          }
          $gradeitem = $DB->get_record('grade_items', array('id' => $lineitemid));
          if ($gradeitem) {
              $gbs = $DB->get_record('ltiservice_gradebookservices',
                      array('gradeitemid' => $gradeitem->id, 'courseid' => $gradeitem->courseid));
              if ($gbs) {
                  return $gbs;
              } else {
                  return false;
              }
          } else {
              return false;
          }
      }
code: public static function find_ltiservice_gradebookservice_for_lineitem($lineitemid) {
          global $DB;
  
          if (!$lineitemid) {
              return false;
          }
          $gradeitem = $DB->get_record('grade_items', array('id' => $lineitemid));
          if ($gradeitem) {
              $gbs = $DB->get_record('ltiservice_gradebookservices',
                      array('gradeitemid' => $gradeitem->id, 'courseid' => $gradeitem->courseid));
              if ($gbs) {
                  return $gbs;
              } else {
                  return false;
              }
          } else {
              return false;
          }
      }
code_tokens: public static function find_ltiservice_gradebookservice_for_lineitem ( $ lineitemid ) { global $ DB ; if ( ! $ lineitemid ) { return false ; } $ gradeitem = $ DB -> get_record ( 'grade_items' , array ( 'id' => $ lineitemid ) ) ; if ( $ gradeitem ) { $ gbs = $ DB -> get_record ( 'ltiservice_gradebookservices' , array ( 'gradeitemid' => $ gradeitem -> id , 'courseid' => $ gradeitem -> courseid ) ) ; if ( $ gbs ) { return $ gbs ; } else { return false ; } } else { return false ; } }
docstring: Find the right element in the ltiservice_gradebookservice table for a lineitem
  
  @param string $lineitemid            The lineitem
  @return object|bool gradebookservice id or false if none
docstring_tokens: Find the right element in the ltiservice_gradebookservice table for a lineitem