Пример #1
0
 /**
  * @throws Horde_Idna_Exception
  */
 public function __get($name)
 {
     switch ($name) {
         case 'bare_address':
             return is_null($this->host) ? $this->mailbox : $this->mailbox . '@' . $this->host;
         case 'bare_address_idn':
             $personal = $this->_personal;
             $this->_personal = null;
             $res = $this->encoded;
             $this->_personal = $personal;
             return $res;
         case 'eai':
             return is_null($this->mailbox) ? false : Horde_Mime::is8bit($this->mailbox);
         case 'encoded':
             return $this->writeAddress(true);
         case 'host':
             return $this->_host;
         case 'host_idn':
             return Horde_Idna::encode($this->_host);
         case 'label':
             return is_null($this->personal) ? $this->bare_address : $this->_personal;
         case 'personal':
             return strcasecmp($this->_personal, $this->bare_address) === 0 ? null : $this->_personal;
         case 'personal_encoded':
             return Horde_Mime::encode($this->personal);
         case 'valid':
             return (bool) strlen($this->mailbox);
     }
 }
Пример #2
0
 /**
  * @dataProvider domainNamesProvider
  */
 public function testEncode($decoded, $encoded)
 {
     $idna = new Horde_Idna();
     $this->assertEquals($encoded, $idna->encode($decoded));
 }