/**
  * Ensures the header isn't empty, and contains a colon character, then
  * splits it and assigns it to $part
  * 
  * @param string $header
  * @param \ZBateson\MailMimeParser\MimePart $part
  */
 private function addRawHeaderToPart($header, MimePart $part)
 {
     if (!empty($header) && strpos($header, ':') !== false) {
         $a = explode(':', $header, 2);
         $part->setRawHeader($a[0], trim($a[1]));
     }
 }
Exemplo n.º 2
0
 public function testGetHeaderParameter()
 {
     $hf = $this->mockHeaderFactory;
     $header = $this->getMockedParameterHeader('First-Header', 'Value', 'param-value');
     $hf->expects($this->exactly(1))->method('newInstance')->withConsecutive([$header->getName(), $header->getValue()])->willReturnOnConsecutiveCalls($header);
     $part = new MimePart($hf);
     $part->setRawHeader($header->getName(), $header->getValue());
     $this->assertEquals('param-value', $part->getHeaderParameter('first-header', 'param'));
 }