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

Commit

Permalink
Update setOptions() signature
Browse files Browse the repository at this point in the history
- Allow passing either array or Traversable object
  • Loading branch information
weierophinney committed Nov 2, 2011
1 parent 184c175 commit c3c4da3
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,15 @@ public function setOption($key, $value)
/**
* Set object state from options array
*
* @param array $options
* @param array|Traversable $options
* @return Zend_Form_Element
*/
public function setOptions(array $options = null)
public function setOptions($options = array())
{
if (!is_array($options) && !$options instanceof Traversable) {
throw new Exception\InvalidArgumentException(__METHOD__ . ' expects an array or Traversable');
}

foreach ($options as $key => $value) {
$this->setOption($key, $value);
}
Expand Down
38 changes: 38 additions & 0 deletions src/Exception/InvalidArgumentException.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_Captcha
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

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

use Zend\Captcha\Exception;

/**
* @category Zend
* @package Zend_Captcha
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class InvalidArgumentException
extends \InvalidArgumentException
implements Exception
{
}

0 comments on commit c3c4da3

Please sign in to comment.