Example #1
0
 public function testConstructorAndGetters()
 {
     $content = 'testContent';
     $contentType = 'testContentType';
     $contentTransferEncoding = 'testContentTransferEncoding';
     $encoding = 'testEncoding';
     $obj = new Content($content, $contentType, $contentTransferEncoding, $encoding);
     $this->assertEquals($content, $obj->getContent());
     $this->assertEquals($contentType, $obj->getContentType());
     $this->assertEquals($contentTransferEncoding, $obj->getContentTransferEncoding());
     $this->assertEquals($encoding, $obj->getEncoding());
 }
Example #2
0
 /**
  * Trying to find links on embedded content, extract it and replace respectively.
  * Returns new instance of Content if there was any replacement or same instance otherwise
  *
  * @param Content       $content
  * @param PartInterface $multipart
  *
  * @return Content
  */
 protected function replaceEmbeddedContent(Content $content, PartInterface $multipart)
 {
     $contentReplacements = $this->loadContents($multipart);
     if ($contentReplacements) {
         $replacedContent = strtr($content->getContent(), $contentReplacements);
         return new Content($replacedContent, $content->getContentType(), $content->getContentTransferEncoding(), $content->getEncoding());
     }
     return $content;
 }