/**
  * Returns the parts parsed for this multipart.
  *
  * @return ezcMailMultipartAlternative
  */
 public function finishMultipart()
 {
     $size = 0;
     foreach ($this->part->getParts() as $part) {
         $size += $part->size;
     }
     $this->part->size = $size;
     return $this->part;
 }
示例#2
0
 public static function printMultipartAlternative(ezcMailMultipartAlternative $mixed)
 {
     //        var_dump( $mixed );
     echo self::indent("[parts] => array\n{\n");
     $counter = 0;
     self::$indentLevel++;
     foreach ($mixed->getParts() as $part) {
         self::printPart($part, $counter);
         $counter++;
     }
     self::$indentLevel--;
     echo self::indent("}\n");
 }
示例#3
0
 public function testGetParts()
 {
     $part = new ezcMailMultipartMixed();
     $part->appendPart(new ezcMailText('a'));
     $this->assertEquals(1, count($part->getParts()));
     $part = new ezcMailMultipartAlternative();
     $part->appendPart(new ezcMailText('a'));
     $this->assertEquals(1, count($part->getParts()));
     $part = new ezcMailMultipartRelated();
     $part->setMainPart($main = new ezcMailText('a'));
     $this->assertEquals($main, $part->getMainPart());
     $part->addRelatedPart(new ezcMailText('a'));
     $part->addRelatedPart(new ezcMailText('a'));
     $this->assertEquals(2, count($part->getRelatedParts()));
 }