Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into rfc/escaper
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 106 changed files with 1,617 additions and 1,861 deletions.
13 changes: 7 additions & 6 deletions src/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Address implements AddressDescription
class Address implements Address\AddressInterface
{
protected $email;
protected $name;

/**
* Constructor
*
* @param string $email
* @param null|string $name
* @return void
*
* @param string $email
* @param null|string $name
* @throws Exception\InvalidArgumentException
* @return Address
*/
public function __construct($email, $name = null)
{
Expand Down Expand Up @@ -64,7 +65,7 @@ public function getEmail()
/**
* Retrieve name
*
* @return null|string
* @return string
*/
public function getName()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@
*
* @category Zend
* @package Zend_Mail
* @subpackage Address
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Mail;
namespace Zend\Mail\Address;

/**
* @category Zend
* @package Zend_Mail
* @subpackage Address
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface AddressDescription
interface AddressInterface
{
public function getEmail();
public function getName();
Expand Down
39 changes: 22 additions & 17 deletions src/AddressList.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

namespace Zend\Mail;

use Countable,
Iterator;
use Countable;
use Iterator;

/**
* @category Zend
Expand All @@ -40,17 +40,17 @@ class AddressList implements Countable, Iterator

/**
* Add an address to the list
*
* @param string|AddressDescription $emailOrAddress
* @param null|string $name
*
* @param string|Address\AddressInterface $emailOrAddress
* @param null|string $name
* @throws Exception\InvalidArgumentException
* @return AddressList
*/
public function add($emailOrAddress, $name = null)
{
if (is_string($emailOrAddress)) {
$emailOrAddress = $this->createAddress($emailOrAddress, $name);
}
if (!$emailOrAddress instanceof AddressDescription) {
} elseif (!$emailOrAddress instanceof Address\AddressInterface) {
throw new Exception\InvalidArgumentException(sprintf(
'%s expects an email address or %s\Address object as its first argument; received "%s"',
__METHOD__,
Expand All @@ -71,11 +71,12 @@ public function add($emailOrAddress, $name = null)
/**
* Add many addresses at once
*
* If an email key is provided, it will be used as the email, and the value
* as the name. Otherwise, the value is passed as the sole argument to add(),
* and, as such, can be either email strings or AddressDescription objects.
*
* @param array $addresses
* If an email key is provided, it will be used as the email, and the value
* as the name. Otherwise, the value is passed as the sole argument to add(),
* and, as such, can be either email strings or Address\AddressInterface objects.
*
* @param array $addresses
* @throws Exception\RuntimeException
* @return AddressList
*/
public function addMany(array $addresses)
Expand Down Expand Up @@ -125,7 +126,7 @@ public function has($email)
* Get an address by email
*
* @param string $email
* @return false|AddressDescription
* @return boolean|Address\AddressInterface
*/
public function get($email)
{
Expand Down Expand Up @@ -166,8 +167,10 @@ public function count()

/**
* Rewind iterator
*
* @return void
*
* @return mixed the value of the first addresses element, or false if the addresses is
* empty.
* @see addresses
*/
public function rewind()
{
Expand Down Expand Up @@ -196,8 +199,10 @@ public function key()

/**
* Move to next item
*
* @return void
*
* @return mixed the addresses value in the next place that's pointed to by the
* internal array pointer, or false if there are no more elements.
* @see addresses
*/
public function next()
{
Expand Down
34 changes: 34 additions & 0 deletions src/Exception/BadMethodCallException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Mail\Exception;

/**
* Exception for Zend_Mail component.
*
* @category Zend
* @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class BadMethodCallException extends \BadMethodCallException implements
ExceptionInterface
{
}
38 changes: 38 additions & 0 deletions src/Exception/DomainException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @version $Id$
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Mail\Exception;

use Zend\Mail\Exception;

/**
* Exception for Zend_Mail component.
*
* @category Zend
* @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class DomainException
extends \DomainException
implements ExceptionInterface
{
}
7 changes: 2 additions & 5 deletions src/Exception.php → src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\Mail;
namespace Zend\Mail\Exception;

/**
* @category Zend
* @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Exception
interface ExceptionInterface
{
}
6 changes: 1 addition & 5 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\Mail\Exception;
use Zend\Mail\Exception;

/**
* Exception for Zend_Mail component.
Expand All @@ -34,6 +30,6 @@
*/
class InvalidArgumentException
extends \InvalidArgumentException
implements Exception
implements ExceptionInterface
{
}
4 changes: 1 addition & 3 deletions src/Exception/OutOfBoundsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

namespace Zend\Mail\Exception;

use Zend\Mail\Exception;

/**
* Exception for Zend_Mail component.
*
Expand All @@ -32,6 +30,6 @@
*/
class OutOfBoundsException
extends \OutOfBoundsException
implements Exception
implements ExceptionInterface
{
}
4 changes: 1 addition & 3 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

namespace Zend\Mail\Exception;

use Zend\Mail\Exception;

/**
* Exception for Zend_Mail component.
*
Expand All @@ -32,6 +30,6 @@
*/
class RuntimeException
extends \RuntimeException
implements Exception
implements ExceptionInterface
{
}
Loading

0 comments on commit 9e5c38e

Please sign in to comment.