Added translateBooleanToYesNo().
authorRoland Haeder <roland@mxchange.org>
Thu, 20 Mar 2014 20:35:39 +0000 (21:35 +0100)
committerRoland Haeder <roland@mxchange.org>
Thu, 20 Mar 2014 20:35:39 +0000 (21:35 +0100)
Signed-off-by: Roland Häder <roland@mxchange.org>
inc/classes/main/class_BaseFrameworkSystem.php

index 01a280d..78cdde3 100644 (file)
@@ -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]