Пример #1
0
 /**
  * Выбрасывает исключение Core.UndestroyablePropertyException
  *
  * @param string $property
  */
 public function __unset($property)
 {
     switch ($property) {
         case 'preamble':
         case 'epilogue':
             throw new Core_UndestroyablePropertyException($property);
         default:
             parent::__unset($property);
     }
 }
Пример #2
0
 /**
  * Декодирует часть сообщения
  *
  * @param Mail_Message_Part $parent
  *
  * @return Mail_Message_Part
  */
 protected function decode_part(Mail_Message_Part $parent)
 {
     if ($parent->is_multipart()) {
         $parent->preamble($this->skip_to_boundary($parent));
         while (true) {
             if (!($head = $this->decode_head())) {
                 break;
             }
             if (Core_Regexps::match('{^[Mm]ultipart}', $head['Content-Type']->value)) {
                 $parent->part($this->decode_part(Mail::Message()->head($head)));
                 $parent->epilogue($this->skip_to_boundary($parent));
             } else {
                 $decoder = MIME_Decode::decoder($head['Content-Transfer-Encoding']->value)->from_stream($this->input)->with_boundary($parent->head['Content-Type']['boundary']);
                 $parent->part(Mail::Part()->head($head)->body($this->is_text_content_type($head['Content-Type']->value) ? $decoder->to_string() : $decoder->to_temporary_stream()));
                 if ($decoder->is_last_part()) {
                     break;
                 }
             }
         }
     } else {
         $decoder = MIME_Decode::decoder($parent->head['Content-Transfer-Encoding']->value)->from_stream($this->input);
         $parent->body($this->is_text_content_type($head['Content-Type']->value) ? $decoder->to_string() : $decoder->to_temporary_stream());
     }
     return $parent;
 }