equal
deleted
inserted
replaced
12 * obtain it through the world-wide-web, please send an email |
12 * obtain it through the world-wide-web, please send an email |
13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_Validate |
16 * @package Zend_Validate |
17 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
17 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @version $Id: CreditCard.php 24593 2012-01-05 20:35:02Z matthew $ |
19 * @version $Id$ |
20 */ |
20 */ |
21 |
21 |
22 /** |
22 /** |
23 * @see Zend_Validate_Abstract |
23 * @see Zend_Validate_Abstract |
24 */ |
24 */ |
25 require_once 'Zend/Validate/Abstract.php'; |
25 require_once 'Zend/Validate/Abstract.php'; |
26 |
26 |
27 /** |
27 /** |
28 * @category Zend |
28 * @category Zend |
29 * @package Zend_Validate |
29 * @package Zend_Validate |
30 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
30 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
31 * @license http://framework.zend.com/license/new-bsd New BSD License |
31 * @license http://framework.zend.com/license/new-bsd New BSD License |
32 */ |
32 */ |
33 class Zend_Validate_CreditCard extends Zend_Validate_Abstract |
33 class Zend_Validate_CreditCard extends Zend_Validate_Abstract |
34 { |
34 { |
35 /** |
35 /** |
134 protected $_service; |
134 protected $_service; |
135 |
135 |
136 /** |
136 /** |
137 * Constructor |
137 * Constructor |
138 * |
138 * |
139 * @param string|array $type OPTIONAL Type of CCI to allow |
139 * @param string|array|Zend_Config $options OPTIONAL Type of CCI to allow |
140 */ |
140 */ |
141 public function __construct($options = array()) |
141 public function __construct($options = array()) |
142 { |
142 { |
143 if ($options instanceof Zend_Config) { |
143 if ($options instanceof Zend_Config) { |
144 $options = $options->toArray(); |
144 $options = $options->toArray(); |
174 |
174 |
175 /** |
175 /** |
176 * Sets CCIs which are accepted by validation |
176 * Sets CCIs which are accepted by validation |
177 * |
177 * |
178 * @param string|array $type Type to allow for validation |
178 * @param string|array $type Type to allow for validation |
179 * @return Zend_Validate_CreditCard Provides a fluid interface |
179 * @return Zend_Validate_CreditCard Provides a fluent interface |
180 */ |
180 */ |
181 public function setType($type) |
181 public function setType($type) |
182 { |
182 { |
183 $this->_type = array(); |
183 $this->_type = array(); |
184 return $this->addType($type); |
184 return $this->addType($type); |
186 |
186 |
187 /** |
187 /** |
188 * Adds a CCI to be accepted by validation |
188 * Adds a CCI to be accepted by validation |
189 * |
189 * |
190 * @param string|array $type Type to allow for validation |
190 * @param string|array $type Type to allow for validation |
191 * @return Zend_Validate_CreditCard Provides a fluid interface |
191 * @return Zend_Validate_CreditCard Provides a fluent interface |
192 */ |
192 */ |
193 public function addType($type) |
193 public function addType($type) |
194 { |
194 { |
195 if (is_string($type)) { |
195 if (is_string($type)) { |
196 $type = array($type); |
196 $type = array($type); |
220 } |
220 } |
221 |
221 |
222 /** |
222 /** |
223 * Sets a new callback for service validation |
223 * Sets a new callback for service validation |
224 * |
224 * |
225 * @param unknown_type $service |
225 * @param mixed $service |
|
226 * @throws Zend_Validate_Exception |
|
227 * @return $this |
226 */ |
228 */ |
227 public function setService($service) |
229 public function setService($service) |
228 { |
230 { |
229 if (!is_callable($service)) { |
231 if (!is_callable($service)) { |
230 require_once 'Zend/Validate/Exception.php'; |
232 require_once 'Zend/Validate/Exception.php'; |