Пример #1
0
 public function testInstance()
 {
     $part = new LiteralPart('"');
     $this->assertNotNull($part);
     $this->assertEquals('"', $part->getValue());
     $part = new LiteralPart(new Token('=?US-ASCII?Q?Kilgore_Trout?='));
     $this->assertEquals('=?US-ASCII?Q?Kilgore_Trout?=', $part->getValue());
 }
Пример #2
0
 /**
  * Tries parsing the header's value as an RFC 2822 date, and failing that
  * into an RFC 822 date.
  * 
  * @param string $token
  */
 public function __construct($token)
 {
     parent::__construct(trim($token));
     $date = DateTime::createFromFormat(DateTime::RFC2822, $this->value);
     if ($date === false) {
         $date = DateTime::createFromFormat(DateTime::RFC822, $this->value);
     }
     $this->date = $date === false ? null : $date;
 }