import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -144,7 +144,7 @@ class Zend_Validate_File_Count extends Zend_Validate_Abstract
|
||||
* Sets the minimum file count
|
||||
*
|
||||
* @param integer|array $min The minimum file count
|
||||
* @return Zend_Validate_File_Size Provides a fluent interface
|
||||
* @return Zend_Validate_File_Count Provides a fluent interface
|
||||
* @throws Zend_Validate_Exception When min is greater than max
|
||||
*/
|
||||
public function setMin($min)
|
||||
@ -208,6 +208,28 @@ class Zend_Validate_File_Count extends Zend_Validate_Abstract
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a file for validation
|
||||
*
|
||||
* @param string|array $file
|
||||
*/
|
||||
public function addFile($file)
|
||||
{
|
||||
if (is_string($file)) {
|
||||
$file = array($file);
|
||||
}
|
||||
|
||||
if (is_array($file)) {
|
||||
foreach ($file as $name) {
|
||||
if (!isset($this->_files[$name]) && !empty($name)) {
|
||||
$this->_files[$name] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Validate_Interface
|
||||
*
|
||||
@ -221,16 +243,7 @@ class Zend_Validate_File_Count extends Zend_Validate_Abstract
|
||||
*/
|
||||
public function isValid($value, $file = null)
|
||||
{
|
||||
if (is_string($value)) {
|
||||
$value = array($value);
|
||||
}
|
||||
|
||||
foreach ($value as $file) {
|
||||
if (!isset($this->_files[$file])) {
|
||||
$this->_files[$file] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
$this->addFile($value);
|
||||
$this->_count = count($this->_files);
|
||||
if (($this->_max !== null) && ($this->_count > $this->_max)) {
|
||||
return $this->_throw($file, self::TOO_MUCH);
|
||||
|
Reference in New Issue
Block a user