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
12 class Address
implements Address\AddressInterface
20 * @param string $email
21 * @param null|string $name
22 * @throws Exception\InvalidArgumentException
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;
43 public function getEmail()
53 public function getName()
59 * String representation of address
63 public function toString()
65 $string = '<' . $this->getEmail() . '>';
66 $name = $this->getName();
71 $string = $name . ' ' . $string;