import v1.1.0_RC2 | 2009-09-20

This commit is contained in:
2019-07-17 22:19:00 +02:00
parent 3b7ba80568
commit 38c146901c
2504 changed files with 101817 additions and 62316 deletions

View File

@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Validate
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: NotEmpty.php 13226 2008-12-14 11:53:29Z thomas $
* @version $Id: NotEmpty.php 17680 2009-08-19 20:02:26Z thomas $
*/
/**
@ -27,18 +27,20 @@ require_once 'Zend/Validate/Abstract.php';
/**
* @category Zend
* @package Zend_Validate
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_NotEmpty extends Zend_Validate_Abstract
{
const INVALID = 'notEmptyInvalid';
const IS_EMPTY = 'isEmpty';
/**
* @var array
*/
protected $_messageTemplates = array(
self::IS_EMPTY => "Value is required and can't be empty"
self::IS_EMPTY => "Value is required and can't be empty",
self::INVALID => "Invalid type given, value should be float, string, array, boolean or integer",
);
/**
@ -51,16 +53,21 @@ class Zend_Validate_NotEmpty extends Zend_Validate_Abstract
*/
public function isValid($value)
{
$this->_setValue((string) $value);
if (!is_string($value) && !is_int($value) && !is_float($value) && !is_bool($value) &&
!is_array($value)) {
$this->_error(self::INVALID);
return false;
}
$this->_setValue($value);
if (is_string($value)
&& (('' === $value)
|| preg_match('/^\s+$/s', $value))
) {
$this->_error();
$this->_error(self::IS_EMPTY);
return false;
} elseif (!is_string($value) && empty($value)) {
$this->_error();
$this->_error(self::IS_EMPTY);
return false;
}