]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/class_BaseFrameworkSystem.php
Continued:
[core.git] / framework / main / classes / class_BaseFrameworkSystem.php
index 3b29231e6362db413dd7afc639b1d55729c3985f..18a2c2c9526e116247c760fa03d5a541bf77b8af 100644 (file)
@@ -46,6 +46,7 @@ use Org\Mxchange\CoreFramework\State\Stateable;
 use Org\Mxchange\CoreFramework\Stream\Input\InputStream;
 use Org\Mxchange\CoreFramework\Stream\Output\OutputStreamer;
 use Org\Mxchange\CoreFramework\Stream\Output\OutputStream;
+use Org\Mxchange\CoreFramework\String\Utils\StringUtils;
 use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
 use Org\Mxchange\CoreFramework\User\ManageableAccount;
 use Org\Mxchange\CoreFramework\Visitor\Visitor;
@@ -1877,7 +1878,7 @@ Loaded includes:
                $className = '';
 
                // Convert all dashes in underscores
-               $str = self::convertDashesToUnderscores($str);
+               $str = StringUtils::convertDashesToUnderscores($str);
 
                // Now use that underscores to get classname parts for hungarian style
                foreach (explode('_', $str) as $strPart) {
@@ -1889,34 +1890,6 @@ Loaded includes:
                return $className;
        }
 
-       /**
-        * Converts dashes to underscores, e.g. useable for configuration entries
-        *
-        * @param       $str    The string with maybe dashes inside
-        * @return      $str    The converted string with no dashed, but underscores
-        * @throws      NullPointerException    If $str is null
-        * @throws      InvalidArgumentException        If $str is empty
-        */
-       public static function convertDashesToUnderscores ($str) {
-               // Is it null?
-               if (is_null($str)) {
-                       // Throw NPE
-                       throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
-               } elseif (!is_string($str)) {
-                       // Entry is empty
-                       throw new InvalidArgumentException(sprintf('str[]=%s is not a string', gettype($str)), FrameworkConfiguration::EXCEPTION_CONFIG_KEY_IS_EMPTY);
-               } elseif ((is_string($str)) && (empty($str))) {
-                       // Entry is empty
-                       throw new InvalidArgumentException('str is empty', FrameworkConfiguration::EXCEPTION_CONFIG_KEY_IS_EMPTY);
-               }
-
-               // Convert them all
-               $str = str_replace('-', '_', $str);
-
-               // Return converted string
-               return $str;
-       }
-
        /**
         * Marks up the code by adding e.g. line numbers
         *
@@ -2079,7 +2052,7 @@ Loaded includes:
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput($fieldName.':<pre>'.print_r($fieldArray, true).'</pre>');
 
                // Convert dashes to underscore
-               $fieldName2 = self::convertDashesToUnderscores($fieldName);
+               $fieldName2 = StringUtils::convertDashesToUnderscores($fieldName);
 
                // Does the field exist?
                if ($this->isFieldSet($fieldName)) {
@@ -2119,7 +2092,7 @@ Loaded includes:
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . $this->__toString() . ':' . __LINE__ . '] fieldName=' . $fieldName . ',fieldArray=<pre>'.print_r($fieldArray, true).'</pre>');
 
                // Convert dashes to underscore
-               $fieldName = self::convertDashesToUnderscores($fieldName);
+               $fieldName = StringUtils::convertDashesToUnderscores($fieldName);
 
                // Determine it
                $isSet = isset($fieldArray[$fieldName]);