mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Reformat Validation class
This commit is contained in:
parent
af8c992655
commit
8b3bba3341
1 changed files with 984 additions and 982 deletions
|
@ -446,11 +446,13 @@ class Validation {
|
|||
|
||||
if ($places === null) {
|
||||
$regex = "/^{$sign}(?:{$lnum}|{$dnum}){$exp}$/";
|
||||
|
||||
} elseif ($places === true) {
|
||||
if (is_float($check) && floor($check) === $check) {
|
||||
$check = sprintf("%.1f", $check);
|
||||
}
|
||||
$regex = "/^{$sign}{$dnum}{$exp}$/";
|
||||
|
||||
} elseif (is_numeric($places)) {
|
||||
$places = '[0-9]{' . $places . '}';
|
||||
$dnum = "(?:[0-9]*[\.]{$places}|{$lnum}[\.]{$places})";
|
||||
|
@ -1028,10 +1030,10 @@ class Validation {
|
|||
if (is_array($check) && isset($check['error'])) {
|
||||
$check = $check['error'];
|
||||
}
|
||||
|
||||
if ($allowNoFile) {
|
||||
return in_array((int) $check, array(UPLOAD_ERR_OK, UPLOAD_ERR_NO_FILE), true);
|
||||
return in_array((int)$check, [UPLOAD_ERR_OK, UPLOAD_ERR_NO_FILE], true);
|
||||
}
|
||||
|
||||
return (int)$check === UPLOAD_ERR_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue