original_string: public function process_endorsement($data) {
          global $DB;
  
          $data = (object)$data;
  
          $params = [
              'badgeid' => $this->get_new_parentid('badge'),
              'issuername' => $data->issuername,
              'issuerurl' => $data->issuerurl,
              'issueremail' => $data->issueremail,
              'claimid' => $data->claimid,
              'claimcomment' => $data->claimcomment,
              'dateissued' => $this->apply_date_offset($data->dateissued)
          ];
          $newid = $DB->insert_record('badge_endorsement', $params);
          $this->set_mapping('endorsement', $data->id, $newid);
      }
code: public function process_endorsement($data) {
          global $DB;
  
          $data = (object)$data;
  
          $params = [
              'badgeid' => $this->get_new_parentid('badge'),
              'issuername' => $data->issuername,
              'issuerurl' => $data->issuerurl,
              'issueremail' => $data->issueremail,
              'claimid' => $data->claimid,
              'claimcomment' => $data->claimcomment,
              'dateissued' => $this->apply_date_offset($data->dateissued)
          ];
          $newid = $DB->insert_record('badge_endorsement', $params);
          $this->set_mapping('endorsement', $data->id, $newid);
      }
code_tokens: public function process_endorsement ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ params = [ 'badgeid' => $ this -> get_new_parentid ( 'badge' ) , 'issuername' => $ data -> issuername , 'issuerurl' => $ data -> issuerurl , 'issueremail' => $ data -> issueremail , 'claimid' => $ data -> claimid , 'claimcomment' => $ data -> claimcomment , 'dateissued' => $ this -> apply_date_offset ( $ data -> dateissued ) ] ; $ newid = $ DB -> insert_record ( 'badge_endorsement' , $ params ) ; $ this -> set_mapping ( 'endorsement' , $ data -> id , $ newid ) ; }
docstring: Create an endorsement for a badge.
  
  @param mixed $data
  @return void
docstring_tokens: Create an endorsement for a badge .