original_string: private function examinePart(&$email, $part)
      {
          //echo '<br />'.$part->part_id.' '.$part->type.' '.$part->dparameters[0]->value;
          //get subtype JPEG, WAV, HTML, PLAIN, etc
          $subtype = \strtolower($part->subtype);
  
          //get encoding 0 = 7bit, 1= 8bit, 2=binary, 3=base64, 4=quoted prinatble, 5=other
          $encoding = $part->encoding;
  
          switch ($subtype) {
  
              case 'plain':
                  if (empty($email->body)) {
                      $email->body_encoding = $encoding;
                      $email->body = imap_fetchbody($this->inbox, $email->index, $part->part_id);
                  }
                  break;
  
              case 'html':
                  $email->body_HTML = imap_fetchbody($this->inbox, $email->index, $part->part_id);
                  break;
  
              case 'applefile':
              case 'gif':
              case 'png':
              case 'jpg':
              case 'jpeg':
              case 'wav':
              case 'mp3':
              case 'mp4':
              case 'flv':
  
                  if ($part->type == 5) {
                      $attachment = new Email_Attachment();
                      $attachment->sizeK = $part->bytes / 1000;
                      $attachment->subtype = $subtype;
                      $attachment->type = $part->type;
                      $attachment->name = $part->dparameters[0]->value;
                      //change jpeg into jpg
                      $attachment->name = \str_ireplace('jpeg', 'jpg', $attachment->name);
                      $attachment->extension = \strtolower(end(explode(".", $attachment->name)));
  
                      $attachment->contents = \imap_fetchbody($this->inbox, $email->index, $part->part_id);
  
                      //decode base64 contents
                      if ($part->encoding == 3) {
                          $attachment->contents = \imap_base64($attachment->contents);
                      }
  
                      $attachment->encoding = $part->encoding;
                      $email->attachments[] = $attachment;
                  }
          }
      }
code: private function examinePart(&$email, $part)
      {
          //echo '<br />'.$part->part_id.' '.$part->type.' '.$part->dparameters[0]->value;
          //get subtype JPEG, WAV, HTML, PLAIN, etc
          $subtype = \strtolower($part->subtype);
  
          //get encoding 0 = 7bit, 1= 8bit, 2=binary, 3=base64, 4=quoted prinatble, 5=other
          $encoding = $part->encoding;
  
          switch ($subtype) {
  
              case 'plain':
                  if (empty($email->body)) {
                      $email->body_encoding = $encoding;
                      $email->body = imap_fetchbody($this->inbox, $email->index, $part->part_id);
                  }
                  break;
  
              case 'html':
                  $email->body_HTML = imap_fetchbody($this->inbox, $email->index, $part->part_id);
                  break;
  
              case 'applefile':
              case 'gif':
              case 'png':
              case 'jpg':
              case 'jpeg':
              case 'wav':
              case 'mp3':
              case 'mp4':
              case 'flv':
  
                  if ($part->type == 5) {
                      $attachment = new Email_Attachment();
                      $attachment->sizeK = $part->bytes / 1000;
                      $attachment->subtype = $subtype;
                      $attachment->type = $part->type;
                      $attachment->name = $part->dparameters[0]->value;
                      //change jpeg into jpg
                      $attachment->name = \str_ireplace('jpeg', 'jpg', $attachment->name);
                      $attachment->extension = \strtolower(end(explode(".", $attachment->name)));
  
                      $attachment->contents = \imap_fetchbody($this->inbox, $email->index, $part->part_id);
  
                      //decode base64 contents
                      if ($part->encoding == 3) {
                          $attachment->contents = \imap_base64($attachment->contents);
                      }
  
                      $attachment->encoding = $part->encoding;
                      $email->attachments[] = $attachment;
                  }
          }
      }
code_tokens: private function examinePart ( & $ email , $ part ) { //echo '<br />'.$part->part_id.' '.$part->type.' '.$part->dparameters[0]->value; //get subtype JPEG, WAV, HTML, PLAIN, etc $ subtype = \ strtolower ( $ part -> subtype ) ; //get encoding 0 = 7bit, 1= 8bit, 2=binary, 3=base64, 4=quoted prinatble, 5=other $ encoding = $ part -> encoding ; switch ( $ subtype ) { case 'plain' : if ( empty ( $ email -> body ) ) { $ email -> body_encoding = $ encoding ; $ email -> body = imap_fetchbody ( $ this -> inbox , $ email -> index , $ part -> part_id ) ; } break ; case 'html' : $ email -> body_HTML = imap_fetchbody ( $ this -> inbox , $ email -> index , $ part -> part_id ) ; break ; case 'applefile' : case 'gif' : case 'png' : case 'jpg' : case 'jpeg' : case 'wav' : case 'mp3' : case 'mp4' : case 'flv' : if ( $ part -> type == 5 ) { $ attachment = new Email_Attachment ( ) ; $ attachment -> sizeK = $ part -> bytes / 1000 ; $ attachment -> subtype = $ subtype ; $ attachment -> type = $ part -> type ; $ attachment -> name = $ part -> dparameters [ 0 ] -> value ; //change jpeg into jpg $ attachment -> name = \ str_ireplace ( 'jpeg' , 'jpg' , $ attachment -> name ) ; $ attachment -> extension = \ strtolower ( end ( explode ( "." , $ attachment -> name ) ) ) ; $ attachment -> contents = \ imap_fetchbody ( $ this -> inbox , $ email -> index , $ part -> part_id ) ; //decode base64 contents if ( $ part -> encoding == 3 ) { $ attachment -> contents = \ imap_base64 ( $ attachment -> contents ) ; } $ attachment -> encoding = $ part -> encoding ; $ email -> attachments [ ] = $ attachment ; } } }
docstring: Check in an email part for attachments and data
  
  @param \sb\Email $email   The email being examined
  @param object    $part    The current part
  @param string    $part_id The id of the part
docstring_tokens: Check in an email part for attachments and data