original_string: public static function get_entry_by_id($id) {
          global $DB, $USER;
  
          $params = self::validate_parameters(self::get_entry_by_id_parameters(), array('id' => $id));
          $id = $params['id'];
          $warnings = array();
  
          // Get and validate the glossary.
          $entry = $DB->get_record('glossary_entries', array('id' => $id), '*', MUST_EXIST);
          list($glossary, $context) = self::validate_glossary($entry->glossaryid);
  
          if (empty($entry->approved) && $entry->userid != $USER->id && !has_capability('mod/glossary:approve', $context)) {
              throw new invalid_parameter_exception('invalidentry');
          }
  
          $entry = glossary_get_entry_by_id($id);
          self::fill_entry_details($entry, $context);
  
          return array(
              'entry' => $entry,
              'ratinginfo' => \core_rating\external\util::get_rating_info($glossary, $context, 'mod_glossary', 'entry',
                  array($entry)),
              'warnings' => $warnings
          );
      }
code: public static function get_entry_by_id($id) {
          global $DB, $USER;
  
          $params = self::validate_parameters(self::get_entry_by_id_parameters(), array('id' => $id));
          $id = $params['id'];
          $warnings = array();
  
          // Get and validate the glossary.
          $entry = $DB->get_record('glossary_entries', array('id' => $id), '*', MUST_EXIST);
          list($glossary, $context) = self::validate_glossary($entry->glossaryid);
  
          if (empty($entry->approved) && $entry->userid != $USER->id && !has_capability('mod/glossary:approve', $context)) {
              throw new invalid_parameter_exception('invalidentry');
          }
  
          $entry = glossary_get_entry_by_id($id);
          self::fill_entry_details($entry, $context);
  
          return array(
              'entry' => $entry,
              'ratinginfo' => \core_rating\external\util::get_rating_info($glossary, $context, 'mod_glossary', 'entry',
                  array($entry)),
              'warnings' => $warnings
          );
      }
code_tokens: public static function get_entry_by_id ( $ id ) { global $ DB , $ USER ; $ params = self :: validate_parameters ( self :: get_entry_by_id_parameters ( ) , array ( 'id' => $ id ) ) ; $ id = $ params [ 'id' ] ; $ warnings = array ( ) ; // Get and validate the glossary. $ entry = $ DB -> get_record ( 'glossary_entries' , array ( 'id' => $ id ) , '*' , MUST_EXIST ) ; list ( $ glossary , $ context ) = self :: validate_glossary ( $ entry -> glossaryid ) ; if ( empty ( $ entry -> approved ) && $ entry -> userid != $ USER -> id && ! has_capability ( 'mod/glossary:approve' , $ context ) ) { throw new invalid_parameter_exception ( 'invalidentry' ) ; } $ entry = glossary_get_entry_by_id ( $ id ) ; self :: fill_entry_details ( $ entry , $ context ) ; return array ( 'entry' => $ entry , 'ratinginfo' => \ core_rating \ external \ util :: get_rating_info ( $ glossary , $ context , 'mod_glossary' , 'entry' , array ( $ entry ) ) , 'warnings' => $ warnings ) ; }
docstring: Get an entry.
  
  @param int $id The entry ID.
  @return array Containing entry and warnings.
  @since Moodle 3.1
  @throws moodle_exception
  @throws invalid_parameter_exception
docstring_tokens: Get an entry .