예제 #1
0
 /**
  * @covers ::__construct
  * @group  Email
  */
 public function testConstruct()
 {
     $email = '*****@*****.**';
     $name = 'John Doe';
     $object = new Address($email, $name);
     $this->assertEquals($email, $object->getEmail());
     $this->assertEquals($name, $object->getName());
 }
예제 #2
0
파일: Recipient.php 프로젝트: fuelphp/email
 public function __construct($type, $email, $name = null)
 {
     if (in_array($type, array('to', 'cc', 'bcc')) === false) {
         throw new InvalidArgumentException('EMA-002: This is not a valid Recipient type. [' . $type . ']');
     }
     $this->type = $type;
     parent::__construct($email, $name);
 }
예제 #3
0
파일: Transport.php 프로젝트: fuelphp/email
 /**
  * Format an address
  *
  * @param Address $address
  *
  * @return string
  *
  * @since 2.0
  */
 public function formatAddress(Address $address)
 {
     $string = $address->getEmail();
     if ($address->hasName()) {
         $name = $address->getName();
         if ($this->config['email']['encode_headers']) {
             $name = $this->encodeMimeHeader($name);
         }
         $string = '"' . $name . '" <' . $string . '>';
     }
     return $string;
 }