From: Roland Haeder Date: Thu, 20 Mar 2014 20:35:39 +0000 (+0100) Subject: Added translateBooleanToYesNo(). X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e09b363cfbdc093f05bde31c40a185ec87525205;p=core.git Added translateBooleanToYesNo(). Signed-off-by: Roland Häder --- diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 01a280da..78cdde3f 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -2714,6 +2714,23 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Return it return $isValid; } + + /** + * Translates boolean TRUE to 'Y' and FALSE to 'N' + * + * @param $boolean Boolean value + * @return $translated Translated boolean value + */ + public static final function translateBooleanToYesNo ($boolean) { + // Make sure it is really boolean + assert(is_bool($boolean)); + + // "Translate" it + $translated = ($boolean === TRUE) ? 'Y' : 'N'; + + // ... and return it + return $translated; + } } // [EOF]