boolean parse method

This commit is contained in:
Steffen Schröder 2014-05-24 18:56:07 +02:00
parent 2ea6233774
commit 01d5c79fee

View File

@ -176,4 +176,18 @@ abstract class Formatter {
} }
return 'OTH'; return 'OTH';
} }
/**
* Parse the given Value into a Bool
*
* @param mixed $value
* @return bool
*/
public static function parseBoolean($value) {
if (is_string($value)) {
$value = strtolower($value);
}
$bool = filter_var($value, FILTER_VALIDATE_BOOLEAN);
return $bool;
}
} }