original_string: public final function get_record_snapshot($tablename, $id) {
          global $DB;
  
          if ($this->restored) {
              throw new \coding_exception('It is not possible to get snapshots from restored events');
          }
  
          if (isset($this->recordsnapshots[$tablename][$id])) {
              return clone($this->recordsnapshots[$tablename][$id]);
          }
  
          $record = $DB->get_record($tablename, array('id'=>$id));
          $this->recordsnapshots[$tablename][$id] = $record;
  
          return $record;
      }
code: public final function get_record_snapshot($tablename, $id) {
          global $DB;
  
          if ($this->restored) {
              throw new \coding_exception('It is not possible to get snapshots from restored events');
          }
  
          if (isset($this->recordsnapshots[$tablename][$id])) {
              return clone($this->recordsnapshots[$tablename][$id]);
          }
  
          $record = $DB->get_record($tablename, array('id'=>$id));
          $this->recordsnapshots[$tablename][$id] = $record;
  
          return $record;
      }
code_tokens: public final function get_record_snapshot ( $ tablename , $ id ) { global $ DB ; if ( $ this -> restored ) { throw new \ coding_exception ( 'It is not possible to get snapshots from restored events' ) ; } if ( isset ( $ this -> recordsnapshots [ $ tablename ] [ $ id ] ) ) { return clone ( $ this -> recordsnapshots [ $ tablename ] [ $ id ] ) ; } $ record = $ DB -> get_record ( $ tablename , array ( 'id' => $ id ) ) ; $ this -> recordsnapshots [ $ tablename ] [ $ id ] = $ record ; return $ record ; }
docstring: Returns cached record or fetches data from database if not cached.
  
  @param string $tablename
  @param int $id
  @return \stdClass
  
  @throws \coding_exception if used after ::restore()
docstring_tokens: Returns cached record or fetches data from database if not cached .