Overview

Packages

  • Jyxo_Beholder
  • Jyxo_Charset
  • Jyxo_Color
  • Jyxo_Css
  • Jyxo_ErrorHandling
  • Jyxo_FirePhp
  • Jyxo_Gettext
    • Parser
  • Jyxo_Html
  • Jyxo_Input
    • Chain
    • Filter
    • Validator
  • Jyxo_Mail
    • Email
    • Parser
    • Sender
  • Jyxo_Rpc
    • Json
    • Xml
  • Jyxo_Shell
  • Jyxo_SpamFilter
  • Jyxo_Spl
  • Jyxo_String
  • Jyxo_Svn
  • Jyxo_Time
  • Jyxo_Timer
  • Jyxo_Webdav
  • Jyxo_XmlReader
  • PHP

Classes

  • Jyxo_Mail_Email
  • Jyxo_Mail_Email_Address
  • Jyxo_Mail_Email_Attachment
  • Jyxo_Mail_Email_Attachment_File
  • Jyxo_Mail_Email_Attachment_InlineFile
  • Jyxo_Mail_Email_Attachment_InlineString
  • Jyxo_Mail_Email_Attachment_String
  • Jyxo_Mail_Email_Body
  • Jyxo_Mail_Email_Header
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  1: <?php
  2: 
  3: /**
  4:  * Jyxo PHP Library
  5:  *
  6:  * LICENSE
  7:  *
  8:  * This source file is subject to the new BSD license that is bundled
  9:  * with this package in the file license.txt.
 10:  * It is also available through the world-wide-web at this URL:
 11:  * https://github.com/jyxo/php/blob/master/license.txt
 12:  */
 13: 
 14: /**
 15:  * Email address.
 16:  *
 17:  * @category Jyxo
 18:  * @package Jyxo_Mail
 19:  * @subpackage Email
 20:  * @copyright Copyright (c) 2005-2011 Jyxo, s.r.o.
 21:  * @license https://github.com/jyxo/php/blob/master/license.txt
 22:  * @author Jaroslav HanslĂ­k
 23:  */
 24: class Jyxo_Mail_Email_Address extends Jyxo_Spl_Object
 25: {
 26:     /**
 27:      * Email address.
 28:      *
 29:      * @var string
 30:      */
 31:     private $email = '';
 32: 
 33:     /**
 34:      * Name.
 35:      *
 36:      * @var string
 37:      */
 38:     private $name = '';
 39: 
 40:     /**
 41:      * Creates an address.
 42:      *
 43:      * @param string $email Email
 44:      * @param string $name Name
 45:      * @throws InvalidArgumentException If an invalid email address was provided
 46:      */
 47:     public function __construct($email, $name = '')
 48:     {
 49:         $this->setEmail($email);
 50:         $this->setName($name);
 51:     }
 52: 
 53:     /**
 54:      * Returns email address.
 55:      *
 56:      * @return string
 57:      */
 58:     public function getEmail()
 59:     {
 60:         return $this->email;
 61:     }
 62: 
 63:     /**
 64:      * Sets email address.
 65:      *
 66:      * @param string $email Email address
 67:      * @return Jyxo_Mail_Email_Address
 68:      * @throws InvalidArgumentException If an invalid email address was provided
 69:      */
 70:     public function setEmail($email)
 71:     {
 72:         $email = trim((string) $email);
 73: 
 74:         // Validity check
 75:         if (!Jyxo_Input_Validator_IsEmail::validate($email)) {
 76:             throw new InvalidArgumentException(sprintf('Invalid email address %s.', $email));
 77:         }
 78: 
 79:         $this->email = $email;
 80: 
 81:         return $this;
 82:     }
 83: 
 84:     /**
 85:      * Returns name.
 86:      *
 87:      * @return string
 88:      */
 89:     public function getName()
 90:     {
 91:         return $this->name;
 92:     }
 93: 
 94:     /**
 95:      * Sets name.
 96:      *
 97:      * @param string $name Name
 98:      * @return Jyxo_Mail_Email_Address
 99:      */
100:     public function setName($name)
101:     {
102:         $this->name = trim((string) $name);
103: 
104:         return $this;
105:     }
106: }
107: 
Jyxo PHP Library API documentation generated by ApiGen 2.3.0