original_string: public static function create_contact($contact, $prefix = '') {
          global $PAGE;
  
          // Create the data we are going to pass to the renderable.
          $userfields = \user_picture::unalias($contact, array('lastaccess'), $prefix . 'id', $prefix);
          $data = new \stdClass();
          $data->userid = $userfields->id;
          $data->useridfrom = null;
          $data->fullname = fullname($userfields);
          // Get the user picture data.
          $userpicture = new \user_picture($userfields);
          $userpicture->size = 1; // Size f1.
          $data->profileimageurl = $userpicture->get_url($PAGE)->out(false);
          $userpicture->size = 0; // Size f2.
          $data->profileimageurlsmall = $userpicture->get_url($PAGE)->out(false);
          // Store the message if we have it.
          $data->ismessaging = false;
          $data->lastmessage = null;
          $data->lastmessagedate = null;
          $data->messageid = null;
          if (isset($contact->smallmessage)) {
              $data->ismessaging = true;
              // Strip the HTML tags from the message for displaying in the contact area.
              $data->lastmessage = clean_param($contact->smallmessage, PARAM_NOTAGS);
              $data->lastmessagedate = $contact->timecreated;
              $data->useridfrom = $contact->useridfrom;
              if (isset($contact->messageid)) {
                  $data->messageid = $contact->messageid;
              }
          }
          $data->isonline = null;
          $user = \core_user::get_user($data->userid);
          if (self::show_online_status($user)) {
              $data->isonline = self::is_online($userfields->lastaccess);
          }
          $data->isblocked = isset($contact->blocked) ? (bool) $contact->blocked : false;
          $data->isread = isset($contact->isread) ? (bool) $contact->isread : false;
          $data->unreadcount = isset($contact->unreadcount) ? $contact->unreadcount : null;
          $data->conversationid = $contact->conversationid ?? null;
  
          return $data;
      }
code: public static function create_contact($contact, $prefix = '') {
          global $PAGE;
  
          // Create the data we are going to pass to the renderable.
          $userfields = \user_picture::unalias($contact, array('lastaccess'), $prefix . 'id', $prefix);
          $data = new \stdClass();
          $data->userid = $userfields->id;
          $data->useridfrom = null;
          $data->fullname = fullname($userfields);
          // Get the user picture data.
          $userpicture = new \user_picture($userfields);
          $userpicture->size = 1; // Size f1.
          $data->profileimageurl = $userpicture->get_url($PAGE)->out(false);
          $userpicture->size = 0; // Size f2.
          $data->profileimageurlsmall = $userpicture->get_url($PAGE)->out(false);
          // Store the message if we have it.
          $data->ismessaging = false;
          $data->lastmessage = null;
          $data->lastmessagedate = null;
          $data->messageid = null;
          if (isset($contact->smallmessage)) {
              $data->ismessaging = true;
              // Strip the HTML tags from the message for displaying in the contact area.
              $data->lastmessage = clean_param($contact->smallmessage, PARAM_NOTAGS);
              $data->lastmessagedate = $contact->timecreated;
              $data->useridfrom = $contact->useridfrom;
              if (isset($contact->messageid)) {
                  $data->messageid = $contact->messageid;
              }
          }
          $data->isonline = null;
          $user = \core_user::get_user($data->userid);
          if (self::show_online_status($user)) {
              $data->isonline = self::is_online($userfields->lastaccess);
          }
          $data->isblocked = isset($contact->blocked) ? (bool) $contact->blocked : false;
          $data->isread = isset($contact->isread) ? (bool) $contact->isread : false;
          $data->unreadcount = isset($contact->unreadcount) ? $contact->unreadcount : null;
          $data->conversationid = $contact->conversationid ?? null;
  
          return $data;
      }
code_tokens: public static function create_contact ( $ contact , $ prefix = '' ) { global $ PAGE ; // Create the data we are going to pass to the renderable. $ userfields = \ user_picture :: unalias ( $ contact , array ( 'lastaccess' ) , $ prefix . 'id' , $ prefix ) ; $ data = new \ stdClass ( ) ; $ data -> userid = $ userfields -> id ; $ data -> useridfrom = null ; $ data -> fullname = fullname ( $ userfields ) ; // Get the user picture data. $ userpicture = new \ user_picture ( $ userfields ) ; $ userpicture -> size = 1 ; // Size f1. $ data -> profileimageurl = $ userpicture -> get_url ( $ PAGE ) -> out ( false ) ; $ userpicture -> size = 0 ; // Size f2. $ data -> profileimageurlsmall = $ userpicture -> get_url ( $ PAGE ) -> out ( false ) ; // Store the message if we have it. $ data -> ismessaging = false ; $ data -> lastmessage = null ; $ data -> lastmessagedate = null ; $ data -> messageid = null ; if ( isset ( $ contact -> smallmessage ) ) { $ data -> ismessaging = true ; // Strip the HTML tags from the message for displaying in the contact area. $ data -> lastmessage = clean_param ( $ contact -> smallmessage , PARAM_NOTAGS ) ; $ data -> lastmessagedate = $ contact -> timecreated ; $ data -> useridfrom = $ contact -> useridfrom ; if ( isset ( $ contact -> messageid ) ) { $ data -> messageid = $ contact -> messageid ; } } $ data -> isonline = null ; $ user = \ core_user :: get_user ( $ data -> userid ) ; if ( self :: show_online_status ( $ user ) ) { $ data -> isonline = self :: is_online ( $ userfields -> lastaccess ) ; } $ data -> isblocked = isset ( $ contact -> blocked ) ? ( bool ) $ contact -> blocked : false ; $ data -> isread = isset ( $ contact -> isread ) ? ( bool ) $ contact -> isread : false ; $ data -> unreadcount = isset ( $ contact -> unreadcount ) ? $ contact -> unreadcount : null ; $ data -> conversationid = $ contact -> conversationid ?? null ; return $ data ; }
docstring: Helper function for creating a contact object.
  
  @param \stdClass $contact
  @param string $prefix
  @return \stdClass
docstring_tokens: Helper function for creating a contact object .