Adding changes to Validation::alphaNumeric().

Added doc comment to Validation::alphaNumeric() and Validation::between()

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3835 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-11-08 01:09:56 +00:00
parent 20da5e67a7
commit d2ffbe2016

View file

@ -80,10 +80,43 @@ class Validation extends Object {
parent::__construct();
}
/**
* Checks that a string contains only integer or letters
*
* Returns true if string contains only integer or letters
*
* $check can be passed as an array:
* array('check' => 'valueToCheck');
*
* @param mixed $check
* @return boolean
*/
function alphaNumeric($check) {
if (is_array($check)) {
$this->_extract($check);
} else {
$this->check = $check;
}
$this->regex = '/[^\\dA-Z]/i';
if($this->_check() === true){
return false;
} else {
return true;
}
}
/**
* Checks that a string is within s specified range.
* Spaces are included in the character count
* Returns true is string matches value min, max, or between min and max,
*
* @param string $check
* @param int $min
* @param int $max
* @return boolean
*/
function between($check, $min, $max) {
$length = strlen($check);
if ($length >= $min && $length <= $max) {