From e09b363cfbdc093f05bde31c40a185ec87525205 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 20 Mar 2014 21:35:39 +0100 Subject: [PATCH] Added translateBooleanToYesNo(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- inc/classes/main/class_BaseFrameworkSystem.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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] -- 2.39.5