Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Mail / Address.php
blob385b9d863832e8f95f64cbc92d1512c9fec639dd
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Mail;
12 class Address implements Address\AddressInterface
14 protected $email;
15 protected $name;
17 /**
18 * Constructor
20 * @param string $email
21 * @param null|string $name
22 * @throws Exception\InvalidArgumentException
23 * @return Address
25 public function __construct($email, $name = null)
27 if (!is_string($email)) {
28 throw new Exception\InvalidArgumentException('Email must be a string');
30 if (null !== $name && !is_string($name)) {
31 throw new Exception\InvalidArgumentException('Name must be a string');
34 $this->email = $email;
35 $this->name = $name;
38 /**
39 * Retrieve email
41 * @return string
43 public function getEmail()
45 return $this->email;
48 /**
49 * Retrieve name
51 * @return string
53 public function getName()
55 return $this->name;
58 /**
59 * String representation of address
61 * @return string
63 public function toString()
65 $string = '<' . $this->getEmail() . '>';
66 $name = $this->getName();
67 if (null === $name) {
68 return $string;
71 $string = $name . ' ' . $string;
72 return $string;