mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-30 23:01:52 +00:00
Update Validator.php
Hi, I have added a strict flag as an argument since anyone who wishes a strict comparison shall have the option, and btw in_array without strict is sort of "useless" in most cases, IMHO. heres why i say so. http://php.net/manual/en/function.in-array.php#106319
This commit is contained in:
parent
e83cd2934c
commit
eb12058860
@ -350,14 +350,14 @@ class Validator
|
||||
* @internal param array $fields
|
||||
* @return bool
|
||||
*/
|
||||
protected function validateIn($field, $value, $params)
|
||||
protected function validateIn($field, $value, $params, $strict = false)
|
||||
{
|
||||
$isAssoc = array_values($params[0]) !== $params[0];
|
||||
if ($isAssoc) {
|
||||
$params[0] = array_keys($params[0]);
|
||||
}
|
||||
|
||||
return in_array($value, $params[0]);
|
||||
return in_array($value, $params[0], $strict);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user