]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 7 Nov 2020 14:46:02 +0000 (15:46 +0100)
committerRoland Häder <roland@mxchange.org>
Sat, 7 Nov 2020 14:46:02 +0000 (15:46 +0100)
- moved class StringUtils to deeper package, needs updating ApplicationHelper!
- moved some methods from monolithic class BaseFrameworkSystem to StringUtils

Signed-off-by: Roland Häder <roland@mxchange.org>
25 files changed:
application/tests/class_ApplicationHelper.php
framework/bootstrap/class_FrameworkBootstrap.php
framework/config-global.php
framework/config/class_FrameworkConfiguration.php
framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/commands/html/class_HtmlLoginAreaCommand.php
framework/main/classes/criteria/class_BaseCriteria.php
framework/main/classes/feature/class_FrameworkFeature.php
framework/main/classes/file_directories/binary/stack/class_StackFile.php
framework/main/classes/helper/class_BaseHelper.php
framework/main/classes/helper/html/links/class_HtmlLinkHelper.php
framework/main/classes/request/html/class_HtmlRequest.php
framework/main/classes/resolver/action/class_BaseActionResolver.php
framework/main/classes/resolver/class_BaseResolver.php
framework/main/classes/resolver/command/class_BaseCommandResolver.php
framework/main/classes/resolver/controller/class_BaseControllerResolver.php
framework/main/classes/template/class_BaseTemplateEngine.php
framework/main/classes/template/image/class_ImageTemplateEngine.php
framework/main/classes/template/mail/class_MailTemplateEngine.php
framework/main/classes/template/menu/class_MenuTemplateEngine.php
framework/main/classes/utils/class_StringUtils.php [deleted file]
framework/main/classes/utils/string/class_StringUtils.php [new file with mode: 0644]
framework/main/exceptions/main/class_InvalidClassNameException.php
framework/main/exceptions/main/class_MissingDecimalsThousandsSeparatorException.php
framework/main/interfaces/class_FrameworkInterface.php

index e4ee79716b69a42944a732eb17b09c1146584f4f..5224a07e997704a4a254f7c5471cabdf3c249b10 100644 (file)
@@ -10,6 +10,7 @@ use Org\Mxchange\CoreFramework\Loader\ClassLoader;
 use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
 use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 /**
  * A class holding general data about the application and some methods for
@@ -142,7 +143,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
                // Get a controller resolver
                $resolverClass = sprintf(
                        'Org\Mxchange\CoreFramework\Tests\Resolver\Controller\%s',
-                       self::convertToClassName(sprintf(
+                       StringUtils::convertToClassName(sprintf(
                                '%s_%s_controller_resolver',
                                $this->getAppShortName(),
                                FrameworkBootstrap::getRequestTypeFromSystem()
index e5d27674116b33130d1acf7e510bbd7af8f6986d..2f73941b7eb01293821df75281ff6b4036926861 100644 (file)
@@ -18,6 +18,7 @@ use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 // Import SPL stuff
 use \BadMethodCallException;
@@ -237,7 +238,7 @@ final class FrameworkBootstrap {
                // Load basic include files to continue bootstrapping
                self::loadInclude(new SplFileInfo(sprintf('%smain%sinterfaces%sclass_FrameworkInterface.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR)));
                self::loadInclude(new SplFileInfo(sprintf('%smain%sclasses%sclass_BaseFrameworkSystem.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR)));
-               self::loadInclude(new SplFileInfo(sprintf('%smain%sclasses%sutils%sclass_StringUtils.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR)));
+               self::loadInclude(new SplFileInfo(sprintf('%smain%sclasses%sutils%sstring%sclass_StringUtils.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR)));
                self::loadInclude(new SplFileInfo(sprintf('%smain%sinterfaces%sregistry%sclass_Registerable.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR)));
                self::loadInclude(new SplFileInfo(sprintf('%sconfig%sclass_FrameworkConfiguration.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR)));
 
@@ -594,7 +595,7 @@ final class FrameworkBootstrap {
                $requestType = self::getRequestTypeFromSystem();
 
                // Create a new request object
-               $requestInstance = ObjectFactory::createObjectByName(sprintf('Org\Mxchange\CoreFramework\Request\%sRequest', BaseFrameworkSystem::convertToClassName($request)));
+               $requestInstance = ObjectFactory::createObjectByName(sprintf('Org\Mxchange\CoreFramework\Request\%sRequest', StringUtils::convertToClassName($request)));
 
                // Remember request instance here
                self::setRequestInstance($requestInstance);
@@ -607,7 +608,7 @@ final class FrameworkBootstrap {
                } // END - if
 
                // ... and a new response object
-               $responseClass = sprintf('Org\Mxchange\CoreFramework\Response\%sResponse', BaseFrameworkSystem::convertToClassName($request));
+               $responseClass = sprintf('Org\Mxchange\CoreFramework\Response\%sResponse', StringUtils::convertToClassName($request));
                $responseInstance = ObjectFactory::createObjectByName($responseClass);
 
                // Remember response instance here
index 1a93ec9c63680c92861809240b4db3a2049f0880..24eecc9edb963cf2a8df124c8b69f273480f0f25 100644 (file)
@@ -460,5 +460,8 @@ $cfg->setConfigEntry('registry_iterator_class', 'Org\Mxchange\CoreFramework\Iter
 // CFG: QUIET-DNS-RESOLVER
 $cfg->setConfigEntry('quiet_dns_resolver', FALSE);
 
-// Remove config from this name-space. Don't worry, no configuration is cleared.
-unset($cfg);
+// CFG: THOUSANDS-SEPARATOR
+$cfg->setConfigEntry('thousands_separator', '.');
+
+// CFG: DECIMALS-SEPARATOR
+$cfg->setConfigEntry('decimals_separator', ',');
index e8a5b308bd4bd8b60d1d5d3de8bed5681a8689da..29fdabea2bc4bfdb063cf8525cc357ccdbc10237 100644 (file)
@@ -9,7 +9,7 @@ use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\String\Utils\StringUtils;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 // Import SPL stuff
 use \InvalidArgumentException;
index 085abf3b4afdbe06f90c56fbbd8d94ca55f3728c..34076636662401fb63df5dc5c02c8407c6c14be1 100644 (file)
@@ -41,9 +41,9 @@ 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\Utils\String\StringUtils;
 use Org\Mxchange\CoreFramework\Visitor\Visitor;
 
 // Import SPL stuff
@@ -232,49 +232,11 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
         */
        private $callbackInstance = NULL;
 
-       /**
-        * Thousands separator
-        */
-       private $thousands = '.'; // German
-
-       /**
-        * Decimal separator
-        */
-       private $decimals  = ','; // German
-
        /**
         * Generic array
         */
        private $genericArray = array();
 
-       /**
-        * Array with bitmasks and such for pack/unpack methods to support both
-        * 32-bit and 64-bit systems
-        */
-       private $packingData = array(
-               32 => array(
-                       'step'   => 3,
-                       'left'   => 0xffff0000,
-                       'right'  => 0x0000ffff,
-                       'factor' => 16,
-                       'format' => 'II',
-               ),
-               64 => array(
-                       'step'   => 7,
-                       'left'   => 0xffffffff00000000,
-                       'right'  => 0x00000000ffffffff,
-                       'factor' => 32,
-                       'format' => 'NN'
-               )
-       );
-
-       /**
-        * Simple 64-bit check, thanks to "Salman A" from stackoverflow.com:
-        *
-        * The integer size is 4 bytes on 32-bit and 8 bytes on a 64-bit system.
-        */
-       private $archArrayElement = false;
-
        /***********************
         * Exception codes.... *
         ***********************/
@@ -408,9 +370,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
                        // Then set it
                        self::$startupTime = microtime(true);
                } // END - if
-
-               // Set array element
-               $this->archArrayElement = (PHP_INT_SIZE === 8 ? 64 : 32);
        }
 
        /**
@@ -1305,35 +1264,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
                return crc32($this->__toString());
        }
 
-       /**
-        * Formats computer generated price values into human-understandable formats
-        * with thousand and decimal separators.
-        *
-        * @param       $value          The in computer format value for a price
-        * @param       $currency       The currency symbol (use HTML-valid characters!)
-        * @param       $decNum         Number of decimals after commata
-        * @return      $price          The for the current language formated price string
-        * @throws      MissingDecimalsThousandsSeparatorException      If decimals or
-        *                                                                                              thousands separator
-        *                                                                                              is missing
-        */
-       public function formatCurrency ($value, $currency = '&euro;', $decNum = 2) {
-               // Are all required attriutes set?
-               if ((!isset($this->decimals)) || (!isset($this->thousands))) {
-                       // Throw an exception
-                       throw new MissingDecimalsThousandsSeparatorException($this, self::EXCEPTION_ATTRIBUTES_ARE_MISSING);
-               } // END - if
-
-               // Cast the number
-               $value = (float) $value;
-
-               // Reformat the US number
-               $price = number_format($value, $decNum, $this->decimals, $this->thousands) . $currency;
-
-               // Return as string...
-               return $price;
-       }
-
        /**
         * Appends a trailing slash to a string
         *
@@ -1616,29 +1546,6 @@ Loaded includes:
                }
        }
 
-       /**
-        * Converts e.g. a command from URL to a valid class by keeping out bad characters
-        *
-        * @param       $str            The string, what ever it is needs to be converted
-        * @return      $className      Generated class name
-        */
-       public static final function convertToClassName ($str) {
-               // Init class name
-               $className = '';
-
-               // Convert all dashes in underscores
-               $str = StringUtils::convertDashesToUnderscores($str);
-
-               // Now use that underscores to get classname parts for hungarian style
-               foreach (explode('_', $str) as $strPart) {
-                       // Make the class name part lower case and first upper case
-                       $className .= ucfirst(strtolower($strPart));
-               } // END - foreach
-
-               // Return class name
-               return $className;
-       }
-
        /**
         * Marks up the code by adding e.g. line numbers
         *
@@ -1783,7 +1690,7 @@ Loaded includes:
         * @return      $fieldValue             Field value from the user
         * @throws      NullPointerException    If the result instance is null
         */
-       public final function getField ($fieldName) {
+       public final function getField (string $fieldName) {
                // Default field value
                $fieldValue = NULL;
 
@@ -1826,7 +1733,7 @@ Loaded includes:
         * @return      $isSet          Whether the given field name is set
         * @throws      NullPointerException    If the result instance is null
         */
-       public function isFieldSet ($fieldName) {
+       public function isFieldSet (string $fieldName) {
                // Get result instance
                $resultInstance = $this->getResultInstance();
 
@@ -2843,7 +2750,7 @@ Loaded includes:
         * @param       $boolean                Boolean value
         * @return      $translated             Translated boolean value
         */
-       public static final function translateBooleanToYesNo ($boolean) {
+       public static final function translateBooleanToYesNo (bool $boolean) {
                // Make sure it is really boolean
                assert(is_bool($boolean));
 
@@ -2854,74 +2761,6 @@ Loaded includes:
                return $translated;
        }
 
-       /**
-        * Encodes raw data (almost any type) by "serializing" it and then pack it
-        * into a "binary format".
-        *
-        * @param       $rawData        Raw data (almost any type)
-        * @return      $encoded        Encoded data
-        */
-       protected function encodeData ($rawData) {
-               // Make sure no objects or resources pass through
-               assert(!is_object($rawData));
-               assert(!is_resource($rawData));
-
-               // First "serialize" it (json_encode() is faster than serialize())
-               $encoded = $this->packString(json_encode($rawData));
-
-               // And return it
-               return $encoded;
-       }
-
-       /**
-        * Pack a string into a "binary format". Please execuse me that this is
-        * widely undocumented. :-(
-        *
-        * @param       $str            Unpacked string
-        * @return      $packed         Packed string
-        * @todo        Improve documentation
-        */
-       protected function packString ($str) {
-               // Debug message
-               //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('str=' . $str . ' - CALLED!');
-
-               // First compress the string (gzcompress is okay)
-               $str = gzcompress($str);
-
-               // Init variable
-               $packed = '';
-
-               // And start the "encoding" loop
-               for ($idx = 0; $idx < strlen($str); $idx += $this->packingData[$this->archArrayElement]['step']) {
-                       $big = 0;
-                       for ($i = 0; $i < $this->packingData[$this->archArrayElement]['step']; $i++) {
-                               $factor = ($this->packingData[$this->archArrayElement]['step'] - 1 - $i);
-
-                               if (($idx + $i) <= strlen($str)) {
-                                       $ord = ord(substr($str, ($idx + $i), 1));
-
-                                       $add = $ord * pow(256, $factor);
-
-                                       $big += $add;
-
-                                       //print 'idx=' . $idx . ',i=' . $i . ',ord=' . $ord . ',factor=' . $factor . ',add=' . $add . ',big=' . $big . PHP_EOL;
-                               } // END - if
-                       } // END - for
-
-                       $l = ($big & $this->packingData[$this->archArrayElement]['left']) >>$this->packingData[$this->archArrayElement]['factor'];
-                       $r = $big & $this->packingData[$this->archArrayElement]['right'];
-
-                       $chunk = str_pad(pack($this->packingData[$this->archArrayElement]['format'], $l, $r), 8, '0', STR_PAD_LEFT);
-                       //* NOISY-DEBUG */ print 'big=' . $big . ',chunk('.strlen($chunk) . ')='.md5($chunk).PHP_EOL;
-
-                       $packed .= $chunk;
-               } // END - for
-
-               // Return it
-               //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('packed=' . $packed . ' - EXIT!');
-               return $packed;
-       }
-
        /**
         * Creates a full-qualified file name (FQFN) for given file name by adding
         * a configured temporary file path to it.
index 0adfc32b05d2169177677a955798a6cb633966ea..e7859fa93f71ee04a48653bd5f8f780a2536beaf 100644 (file)
@@ -13,7 +13,7 @@ use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
 use Org\Mxchange\CoreFramework\Response\Responseable;
-use Org\Mxchange\CoreFramework\String\Utils\StringUtils;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 /**
  * A command for the login area (member/gamer area)
index df5a8cdf6d23321c53f31d1e0aa6651d0ead4d71..1073cbc4347d1550a4c3d25bfac17e8452389ec9 100644 (file)
@@ -6,7 +6,7 @@ namespace Org\Mxchange\CoreFramework\Criteria;
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Criteria\Search\SearchCriteria;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
-use Org\Mxchange\CoreFramework\String\Utils\StringUtils;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 /**
  * A general crtieria class
index 6310f98e6f0add8a28e5ac2f9132744abfa7c3fe..f5d87d9595b34a69d1da544360493f952899b99f 100644 (file)
@@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Loader\NoClassException;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 /**
  * The general feature management class. No instance is needed as this class
@@ -156,7 +157,7 @@ class FrameworkFeature extends BaseFrameworkSystem {
                // Array for call-back
                $callable = array(
                        self::$enabledFeatures[$featureName]['instance'],
-                       sprintf('featureMethod%s', self::convertToClassName($featureMethod))
+                       sprintf('featureMethod%s', StringUtils::convertToClassName($featureMethod))
                );
 
                // So is the feature's method callable?
index 7a41398a3db325905d210da9bde951d2d9f47846..f1ff7e47dd5eeb6d549252c82aece32af18f4da4 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Filesystem\Stack;
 use Org\Mxchange\CoreFramework\Filesystem\Block;
 use Org\Mxchange\CoreFramework\Filesystem\File\BaseBinaryFile;
 use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
+use Org\Mxchange\CoreFramework\String\Util\StringUtils;
 
 // Import SPL stuff
 use \SplFileInfo;
@@ -77,7 +78,7 @@ class StackFile extends BaseBinaryFile implements Block {
                assert(!is_resource($value));
 
                // Encode/convert the value into a "binary format"
-               $encoded = $this->encodeData($value);
+               $encoded = StringUtils::encodeData($value);
 
                // Get a strong hash for the "encoded" data
                $hash = self::hash($encoded);
index 6ab87f05c267b6c8f156a965ef6ddfde19cb4f59..e9cbdf38052175a9e69435470b11e77c46c7ca6e 100644 (file)
@@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 /**
  * A generic helper class with generic methods
@@ -198,7 +199,7 @@ abstract class BaseHelper extends BaseFrameworkSystem {
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput($fieldName.'='.$fieldValue);
 
                // Now filter it through the value through the filter method
-               $filteredValue = call_user_func_array(array($this, 'doFilter' . self::convertToClassName($filterMethod)), array($fieldValue));
+               $filteredValue = call_user_func_array(array($this, 'doFilter' . StringUtils::convertToClassName($filterMethod)), array($fieldValue));
 
                // Assign it with a template variable
                $this->getTemplateInstance()->assignVariable('block_' . $fieldName, $filteredValue);
index caba4ff11b7e82e2758627e87c7870332d7df561..13552a20490f712cf8cf673d51ff593b443ab3ac 100644 (file)
@@ -8,7 +8,7 @@ use Org\Mxchange\CoreFramework\Configuration\FrameworkConfiguration;
 use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
-use Org\Mxchange\CoreFramework\String\Utils\StringUtils;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
 
 /**
index 391fc8fa5b8ecb577f508bbbc0d62b98cf5a90c3..f8b0fdbaf3a26e252cf2552e08891e121d2c5124 100644 (file)
@@ -4,7 +4,7 @@ namespace Org\Mxchange\CoreFramework\Request;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Request\Requestable;
-use Org\Mxchange\CoreFramework\String\Utils\StringUtils;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 /**
  * A concrete and secured HTML request class to make HTML requests more abstract
index cff62f7eed6df6bc748771e50cde9b8a9381a130..9834165250df87fecb5d51af4f567dcda744238e 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Resolver\Action;
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Resolver\BaseResolver;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 // Import SPL stuff
 use \InvalidArgumentException;
@@ -90,7 +91,7 @@ abstract class BaseActionResolver extends BaseResolver {
                        '%s\%s%sAction',
                        $namespace,
                        $this->getCapitalizedClassPrefix(),
-                       self::convertToClassName($actionName)
+                       StringUtils::convertToClassName($actionName)
                );
 
                // Now, let us create the full name of the action class
@@ -123,7 +124,7 @@ abstract class BaseActionResolver extends BaseResolver {
                        '%s\%s%sAction',
                        $this->getNamespace(),
                        $this->getCapitalizedClassPrefix(),
-                       self::convertToClassName($actionName)
+                       StringUtils::convertToClassName($actionName)
                );
 
                // ... and set it
index 46f1a0d59236e0dfdeba0a3a1ee50f0c8904b88a..7b262c3766c8824bd331a523ddaf7977dcee14ad 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Resolver;
 use Org\Mxchange\CoreFramework\Controller\Controller;
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 /**
  * A generic resolver class
@@ -120,7 +121,7 @@ abstract class BaseResolver extends BaseFrameworkSystem {
                $className = $this->getClassPrefix();
 
                // And capitalize it
-               $className = self::convertToClassName($className);
+               $className = StringUtils::convertToClassName($className);
 
                // Return it
                return $className;
index 98c3a81e3dc19d1ec7286881a49a22a3f911976e..ed9fbdf6435f4a56bd224e844f4e59503ef4b3d9 100644 (file)
@@ -9,6 +9,7 @@ use Org\Mxchange\CoreFramework\Command\InvalidCommandException;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Resolver\BaseResolver;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 // Import SPL stuff
 use \InvalidArgumentException;
@@ -89,7 +90,7 @@ abstract class BaseCommandResolver extends BaseResolver {
                        '%s\%s%sCommand',
                        $this->getNamespace(),
                        $this->getCapitalizedClassPrefix(),
-                       self::convertToClassName($commandName)
+                       StringUtils::convertToClassName($commandName)
                );
 
                // Create command class name
@@ -218,7 +219,7 @@ abstract class BaseCommandResolver extends BaseResolver {
                        '%s\%s%sCommand',
                        $namespace,
                        $this->getCapitalizedClassPrefix(),
-                       self::convertToClassName($commandName)
+                       StringUtils::convertToClassName($commandName)
                );
 
                // Now, let us create the full name of the command class
index 1da067a87152e65eb5d4b9bd2196bde7dd9da09e..12281e34d44524211cf20089445e0cce6ccb32ce 100644 (file)
@@ -11,6 +11,7 @@ use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Resolver\BaseResolver;
 use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 // Import SPL stuff
 use \InvalidArgumentException;
@@ -108,7 +109,7 @@ abstract class BaseControllerResolver extends BaseResolver {
                                '%s\%s%sController',
                                $this->getNamespace(),
                                $this->getCapitalizedClassPrefix(),
-                               self::convertToClassName($controllerName)
+                               StringUtils::convertToClassName($controllerName)
                        );
 
                        // ... and set it
@@ -175,7 +176,7 @@ abstract class BaseControllerResolver extends BaseResolver {
                $className = sprintf(
                        '%s\%sController',
                        $namespace,
-                       $this->getCapitalizedClassPrefix() . self::convertToClassName($controllerName)
+                       $this->getCapitalizedClassPrefix() . StringUtils::convertToClassName($controllerName)
                );
                $newsControllerName = sprintf(
                        '%s\%sDefaultNewsController',
index 87642847795d5479e65638ec5df1f8df94d95cd9..772fa885b04850eb8aa299aefab156179e29f998 100644 (file)
@@ -13,7 +13,7 @@ use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Response\Responseable;
-use Org\Mxchange\CoreFramework\String\Utils\StringUtils;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 // Import SPL stuff
 use \InvalidArgumentException;
@@ -1456,7 +1456,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                // Is this view helper loaded?
                if (!isset($this->helpers[$helperName])) {
                        // Create a class name
-                       $className = self::convertToClassName($helperName) . 'ViewHelper';
+                       $className = StringUtils::convertToClassName($helperName) . 'ViewHelper';
 
                        // Generate new instance
                        $this->helpers[$helperName] = ObjectFactory::createObjectByName($className);
index 1ef96f6d2503e1a855c03303c626007068142167..855744872c939d714f660d7227e8e486f6825aa3 100644 (file)
@@ -11,6 +11,7 @@ use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Response\Responseable;
 use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
 use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 // Import SPL stuff
 use \SplFileInfo;
@@ -182,10 +183,10 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
                //* DEBUG: */ echo "START: &gt;".$element."&lt;<br />\n";
                if (in_array($element, $this->mainNodes)) {
                        // Okay, main node found!
-                       $methodName = 'setImage' . self::convertToClassName($element);
+                       $methodName = 'setImage' . StringUtils::convertToClassName($element);
                } elseif (in_array($element, $this->subNodes)) {
                        // Sub node found
-                       $methodName = 'setImageProperty' . self::convertToClassName($element);
+                       $methodName = 'setImageProperty' . StringUtils::convertToClassName($element);
                } elseif ($element != 'image') {
                        // Invalid node name found
                        throw new InvalidXmlNodeException(array($this, $element, $attributes), XmlParser::EXCEPTION_XML_NODE_UNKNOWN);
@@ -219,7 +220,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
                }
 
                // Construct method name
-               $methodName = 'finish' . self::convertToClassName($nodeName);
+               $methodName = 'finish' . StringUtils::convertToClassName($nodeName);
 
                // Call the corresponding method
                call_user_func_array(array($this->getImageInstance(), $methodName), array());
@@ -271,7 +272,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
                $imageType = $this->compileRawCode($imageType);
 
                // Now make a class name of it
-               $className = self::convertToClassName($imageType.'_image');
+               $className = StringUtils::convertToClassName($imageType.'_image');
 
                // And try to initiate it
                $this->setImageInstance(ObjectFactory::createObjectByName($className, array($this)));
index e68a66e64ebc722ff4378a104476d552be71db9a..a442cf1e89e00c025d68c63e0997fec229f61947 100644 (file)
@@ -11,6 +11,7 @@ use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Response\Responseable;
 use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
 use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 // Import SPL stuff
 use \UnexpectedValueException;
@@ -175,10 +176,10 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
                //* DEBUG: */ echo "START: &gt;".$element."&lt;<br />\n";
                if (in_array($element, $this->getMainNodes())) {
                        // Okay, main node found!
-                       $methodName = 'setEmail' . self::convertToClassName($element);
+                       $methodName = 'setEmail' . StringUtils::convertToClassName($element);
                } elseif (in_array($element, $this->getSubNodes())) {
                        // Sub node found
-                       $methodName = 'setEmailProperty' . self::convertToClassName($element);
+                       $methodName = 'setEmailProperty' . StringUtils::convertToClassName($element);
                } elseif ($element != 'text-mail') {
                        // Invalid node name found
                        throw new InvalidXmlNodeException(array($this, $element, $attributes), XmlParser::EXCEPTION_XML_NODE_UNKNOWN);
@@ -212,7 +213,7 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
                }
 
                // Construct method name
-               $methodName = 'finish' . self::convertToClassName($nodeName);
+               $methodName = 'finish' . StringUtils::convertToClassName($nodeName);
 
                // Call the corresponding method
                call_user_func_array(array($this, $methodName), array());
index 0bc2e03e521f7203cc50a4b74aae0d82e1b507df..39177f1d9a06b2dc79a1b4a4c95cc26c69731a1a 100644 (file)
@@ -11,6 +11,7 @@ use Org\Mxchange\CoreFramework\Parser\Xml\XmlParser;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
 use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 // Import SPL stuff
 use \SplFileInfo;
@@ -270,13 +271,13 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
                //* DEBUG: */ echo "START: &gt;".$element."&lt;<br />\n";
                if (in_array($element, $this->getMainNodes())) {
                        // Okay, main node found!
-                       $methodName = 'start' . self::convertToClassName($element);
+                       $methodName = 'start' . StringUtils::convertToClassName($element);
 
                        // Set it
                        $this->setCurrMainNode($element);
                } elseif (in_array($element, $this->getSubNodes())) {
                        // Sub node found
-                       $methodName = 'start' . self::convertToClassName($element);
+                       $methodName = 'start' . StringUtils::convertToClassName($element);
                } elseif ($element != 'menu') {
                        // Invalid node name found
                        throw new InvalidXmlNodeException(array($this, $element, $attributes), XmlParser::EXCEPTION_XML_NODE_UNKNOWN);
@@ -307,7 +308,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
                } // END - if
 
                // Construct method name
-               $methodName = 'finish' . self::convertToClassName($nodeName);
+               $methodName = 'finish' . StringUtils::convertToClassName($nodeName);
 
                // Call the corresponding method
                //* DEBUG: */ echo "call: ".$methodName."<br />\n";
diff --git a/framework/main/classes/utils/class_StringUtils.php b/framework/main/classes/utils/class_StringUtils.php
deleted file mode 100644 (file)
index de0e7c8..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\String\Utils;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Configuration\FrameworkConfiguration;
-use Org\Mxchange\CoreFramework\Generic\NullPointerException;
-use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
-
-// Import SPL stuff
-use \InvalidArgumentException;
-
-/**
- * A string utility class
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-final class StringUtils extends BaseFrameworkSystem {
-       /**
-        * Private constructor, no instance needed
-        *
-        * @return      void
-        */
-       private function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * 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;
-       }
-
-}
diff --git a/framework/main/classes/utils/string/class_StringUtils.php b/framework/main/classes/utils/string/class_StringUtils.php
new file mode 100644 (file)
index 0000000..8d4a228
--- /dev/null
@@ -0,0 +1,243 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Utils\String;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Configuration\FrameworkConfiguration;
+use Org\Mxchange\CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+
+// Import SPL stuff
+use \InvalidArgumentException;
+
+/**
+ * A string utility class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+final class StringUtils extends BaseFrameworkSystem {
+       /**
+        * Thousands separator
+        */
+       private static $thousands = ''; // German
+
+       /**
+        * Decimal separator
+        */
+       private static $decimals  = ''; // German
+
+       /**
+        * Array with bitmasks and such for pack/unpack methods to support both
+        * 32-bit and 64-bit systems
+        */
+       private static $packingData = array(
+               32 => array(
+                       'step'   => 3,
+                       'left'   => 0xffff0000,
+                       'right'  => 0x0000ffff,
+                       'factor' => 16,
+                       'format' => 'II',
+               ),
+               64 => array(
+                       'step'   => 7,
+                       'left'   => 0xffffffff00000000,
+                       'right'  => 0x00000000ffffffff,
+                       'factor' => 32,
+                       'format' => 'NN'
+               )
+       );
+
+       /**
+        * Simple 64-bit check, thanks to "Salman A" from stackoverflow.com:
+        *
+        * The integer size is 4 bytes on 32-bit and 8 bytes on a 64-bit system.
+        */
+       private static $archArrayElement = 0;
+
+       /**
+        * Private constructor, no instance needed. If PHP would have a static initializer ...
+        *
+        * @return      void
+        */
+       private function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Is one not set?
+               if (empty(self::$archArrayElement)) {
+                       // Set array element
+                       self::$archArrayElement = (PHP_INT_SIZE === 8 ? 64 : 32);
+
+                       // Init from configuration
+                       self::$thousands = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('thousands_separator');
+                       self::$decimals = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('decimals_separator');
+               }
+       }
+
+       /**
+        * 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;
+       }
+
+       /**
+        * Encodes raw data (almost any type) by "serializing" it and then pack it
+        * into a "binary format".
+        *
+        * @param       $rawData        Raw data (almost any type)
+        * @return      $encoded        Encoded data
+        * @throws      InvalidArgumentException        If $rawData has a non-serializable data type
+        */
+       public static function encodeData ($rawData) {
+               // Make sure no objects or resources pass through
+               //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('STRING-UTILS: rawData[]=%s - CALLED!', gettype($rawData)));
+               if (is_object($rawData) || is_resource($rawData)) {
+                       // Not all variable types should be serialized here
+                       throw new InvalidArgumentException(sprintf('rawData[]=%s cannot be serialized.', gettype($rawData)));
+               }
+
+               // Init instance
+               $dummyInstance = new StringUtils();
+
+               // First "serialize" it (json_encode() is faster than serialize())
+               $encoded = self::packString(json_encode($rawData));
+
+               // And return it
+               //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('STRING-UTILS: encoded()=%d - EXIT!', strlen($encoded)));
+               return $encoded;
+       }
+
+       /**
+        * Converts e.g. a command from URL to a valid class by keeping out bad characters
+        *
+        * @param       $str            The string, what ever it is needs to be converted
+        * @return      $className      Generated class name
+        */
+       public static final function convertToClassName (string $str) {
+               // Init class name
+               $className = '';
+
+               // Convert all dashes in underscores
+               $str = self::convertDashesToUnderscores($str);
+
+               // Now use that underscores to get classname parts for hungarian style
+               foreach (explode('_', $str) as $strPart) {
+                       // Make the class name part lower case and first upper case
+                       $className .= ucfirst(strtolower($strPart));
+               }
+
+               // Return class name
+               return $className;
+       }
+
+       /**
+        * Formats computer generated price values into human-understandable formats
+        * with thousand and decimal separators.
+        *
+        * @param       $value          The in computer format value for a price
+        * @param       $currency       The currency symbol (use HTML-valid characters!)
+        * @param       $decNum         Number of decimals after commata
+        * @return      $price          The for the current language formated price string
+        * @throws      MissingDecimalsThousandsSeparatorException      If decimals or thousands separator is missing
+        */
+       public static function formatCurrency (float $value, string $currency = '&euro;', int $decNum = 2) {
+               // Init instance
+               $dummyInstance = new StringUtils();
+
+               // Reformat the US number
+               $price = number_format($value, $decNum, self::$decimals, self::$thousands) . $currency;
+
+               // Return as string...
+               return $price;
+       }
+
+       /**
+        * Pack a string into a "binary format". Please execuse me that this is
+        * widely undocumented. :-(
+        *
+        * @param       $str            Unpacked string
+        * @return      $packed         Packed string
+        * @todo        Improve documentation
+        */
+       private static function packString (string $str) {
+               // First compress the string (gzcompress is okay)
+               //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('STRING-UTILS: str=%s - CALLED!', $str));
+               $str = gzcompress($str);
+
+               // Init variable
+               $packed = '';
+
+               // And start the "encoding" loop
+               for ($idx = 0; $idx < strlen($str); $idx += self::$packingData[self::$archArrayElement]['step']) {
+                       $big = 0;
+                       for ($i = 0; $i < self::$packingData[self::$archArrayElement]['step']; $i++) {
+                               $factor = (self::$packingData[self::$archArrayElement]['step'] - 1 - $i);
+
+                               if (($idx + $i) <= strlen($str)) {
+                                       $ord = ord(substr($str, ($idx + $i), 1));
+
+                                       $add = $ord * pow(256, $factor);
+
+                                       $big += $add;
+
+                                       //print 'idx=' . $idx . ',i=' . $i . ',ord=' . $ord . ',factor=' . $factor . ',add=' . $add . ',big=' . $big . PHP_EOL;
+                               }
+                       }
+
+                       // Left/right parts (low/high?)
+                       $l = ($big & self::$packingData[self::$archArrayElement]['left']) >>self::$packingData[self::$archArrayElement]['factor'];
+                       $r = $big & self::$packingData[self::$archArrayElement]['right'];
+
+                       // Create chunk
+                       $chunk = str_pad(pack(self::$packingData[self::$archArrayElement]['format'], $l, $r), 8, '0', STR_PAD_LEFT);
+                       //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('STRING-UTILS: big=%d,chunk(%d)=%s', $big, strlen($chunk), md5($chunk)));
+
+                       $packed .= $chunk;
+               } // END - for
+
+               // Return it
+               //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('STRING-UTILS: packed=%s - EXIT!', $packed));
+               return $packed;
+       }
+
+}
index 952f35befd2aa4ee3f72eee102511c06a6e418b0..7d6dceec926b2c790d8a6cc64b29a822d57f79e9 100644 (file)
@@ -1,50 +1,2 @@
 <?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Deprecated;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Generic\FrameworkException;
-
-/**
- * An exception thrown when the decimal and thousands separators are missing
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- * @deprecated Don't use this anymore
- * 
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class MissingDecimalsThousandsSeparatorException extends FrameworkException {
-       /**
-        * The constructor
-        *
-        * @param       $message        Message from the exception
-        * @param       $code           Code number for the exception
-        * @return      void
-        */
-       public function __construct ($instance, $code) {
-               // Add a message around the missing class
-               $message = sprintf('[%s:%d] Decimal and thousand seperators are missing.',
-                       $instance->__toString(),
-                       $this->getLine()
-               );
-
-               // Call parent constructor
-               parent::__construct($message, $code);
-       }
-
-}
+// @DEPRECATED
index f14dbc034d9692494acf892077797d58a9236178..5b744e15e58f7f1ea96b9c63a44c96cab5004675 100644 (file)
@@ -34,7 +34,7 @@ interface FrameworkInterface {
         * @return      $fieldValue             Field value from the user
         * @throws      NullPointerException    If the result instance is null
         */
-       function getField ($fieldName);
+       function getField (string $fieldName);
 
        /**
         * Checks if given field is set
@@ -43,7 +43,7 @@ interface FrameworkInterface {
         * @return      $isSet          Whether the given field name is set
         * @throws      NullPointerException    If the result instance is null
         */
-       function isFieldSet ($fieldName);
+       function isFieldSet (string $fieldName);
 
        /**
         * Setter for call-back instance