Skip to content
Permalink
Browse files

allow value lists for boolean, truthy, falsey to actually be replaced…

…/changed/removed
  • Loading branch information...
inoas committed Oct 4, 2016
1 parent cecd991 commit 912bebf769cdc8d8ddb4e5e98d88b2a5272ca320
Showing with 9 additions and 3 deletions.
  1. +9 −3 src/Validation/Validation.php
@@ -530,7 +530,9 @@ public static function localizedTime($check, $type = 'datetime', $format = null)
*/
public static function boolean($check, array $booleanValues = [])
{
$booleanValues = array_merge([true, false, 0, 1, '0', '1'], $booleanValues);
if (!$booleanValues) {
$booleanValues = [true, false, 0, 1, '0', '1'];
}
return in_array($check, $booleanValues, true);
}
@@ -545,7 +547,9 @@ public static function boolean($check, array $booleanValues = [])
*/
public static function truthy($check, array $truthyValues = [])
{
$truthyValues = array_merge([true, 1, '1'], $truthyValues);
if (!$truthyValues) {
$truthyValues = [true, 1, '1'];
}
return in_array($check, $truthyValues, true);
}
@@ -560,7 +564,9 @@ public static function truthy($check, array $truthyValues = [])
*/
public static function falsey($check, array $falseyValues = [])
{
$falseyValues = array_merge([false, 0, '0'], $falseyValues);
if (!$falseyValues) {
$falseyValues = [false, 0, '0'];
}
return in_array($check, $falseyValues, true);
}

0 comments on commit 912bebf

Please sign in to comment.
You can’t perform that action at this time.