]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Fri, 22 Aug 2025 20:49:29 +0000 (22:49 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 22 Aug 2025 20:49:29 +0000 (22:49 +0200)
- switched to "new" [] style instead of old-fashioned array()
- changed type-hint from DebugMiddleware (class) to Logger (interface)

framework/config/class_FrameworkConfiguration.php
framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/utils/strings/class_StringUtils.php
framework/main/interfaces/class_FrameworkInterface.php
framework/main/interfaces/lists/class_Listable.php

index 257eede25f7e505071edfbaa2e9f9172214494a7..1a6a26a4b09ad06996bebdf59a52dcf0b29399da 100644 (file)
@@ -210,7 +210,7 @@ class FrameworkConfiguration implements Registerable {
                //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s - AFTER!' . PHP_EOL, __METHOD__, __LINE__, $configKey);
                if (!$this->isConfigurationEntrySet($configKey)) {
                        // Entry was not found!
-                       throw new NoConfigEntryException(array(__CLASS__, $configKey), self::EXCEPTION_CONFIG_KEY_WAS_NOT_FOUND);
+                       throw new NoConfigEntryException([__CLASS__, $configKey], self::EXCEPTION_CONFIG_KEY_WAS_NOT_FOUND);
                }
 
                // Unset it
index 1d1ee39738401669880784c67efa1be685328304..81a03b293f56d664d1ccb11b9281d72673435b33 100644 (file)
@@ -13,6 +13,7 @@ use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
 use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Loader\ClassLoader;
+use Org\Mxchange\CoreFramework\Logging\Logger;
 use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
 use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry;
@@ -393,10 +394,10 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
        /**
         * Setter for debug instance
         *
-        * @param       $debugInstance  The instance for debug output class
+        * @param       $debugInstance  An instance of a Logger class
         * @return      void
         */
-       public final function setDebugInstance (DebugMiddleware $debugInstance): void {
+       public final function setDebugInstance (Logger $debugInstance): void {
                self::$debugInstance = $debugInstance;
        }
 
@@ -405,7 +406,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
         *
         * @return      $debugInstance  Instance to class DebugConsoleOutput or DebugWebOutput
         */
-       public final function getDebugInstance (): DebugMiddleware {
+       public final function getDebugInstance (): Logger {
                return self::$debugInstance;
        }
 
@@ -599,7 +600,7 @@ Loaded includes:
         * @throws      InvalidArgumentException        If a parameter has an invalid value
         * @deprecated  Not fully, as the new Logger facilities are not finished yet.
         */
-       public final static function createDebugInstance (string $className, int $lineNumber = 0): DebugMiddleware {
+       public final static function createDebugInstance (string $className, int $lineNumber = 0): Logger {
                // Validate parameter
                //* NOISY-DEBUG: */ printf('[%s:%d]: className=%s,lineNumber[%s]=%d - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $className, gettype($lineNumber), $lineNumber);
                if (empty($className)) {
@@ -629,25 +630,6 @@ Loaded includes:
                return self::$debugInstance;
        }
 
-       /**
-        * Simple output of a message with line-break
-        *
-        * @param       $message        Message to output
-        * @return      void
-        * @throws      InvalidArgumentException        If a paramter has an invalid value
-        */
-       public function outputLine (string $message): void {
-               // Check parameter
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FRAMEWORK-SYSTEM: message=%s - CALLED!', $message));
-               if (empty($message)) {
-                       // Throw IAE
-                       throw new InvalidArgumentException('Parameter "message" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
-               }
-
-               // Simply output it
-               print($message . PHP_EOL);
-       }
-
        /**
         * Marks up the code by adding e.g. line numbers
         *
@@ -699,12 +681,12 @@ Loaded includes:
         * @return      $entry  An array with database entries
         * @throws      NullPointerException    If the database result is not found
         * @throws      InvalidDatabaseResultException  If the database result is invalid
-        * @deprecated  Monolithic method, should be moved to proper classes
+        * @deprecated  Monolithic method, should be avoided by using DatabaseResult classes instead
         */
        protected final function getDatabaseEntry (): array {
                // This method is deprecated
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FRAMEWORK-SYSTEM: CALLED!');
-               $this->deprecationWarning('Monolithic method, should be moved to proper classes');
+               $this->deprecationWarning('Monolithic method, should be avoided by using DatabaseResult classes instead');
 
                // Is there an instance?
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FRAMEWORK-SYSTEM: this->resultInstance[]=%s', gettype($this->getResultInstance())));
@@ -743,7 +725,7 @@ Loaded includes:
         * @return      $fieldValue             Field value from the user
         * @throws      NullPointerException    If the result instance is null
         * @throws      InvalidArgumentException        If a parameter is not valid
-        * @deprecated  Monolithic method, should be moved to proper classes
+        * @deprecated  Monolithic method, should be avoided by using DatabaseResult classes instead
         */
        public final function getField (string $fieldName): mixed {
                // Check parameter
@@ -754,7 +736,7 @@ Loaded includes:
                }
 
                // This method is deprecated
-               $this->deprecationWarning('Monolithic method, should be moved to proper classes');
+               $this->deprecationWarning('Monolithic method, should be avoided by using DatabaseResult classes instead');
 
                // Default field value
                $fieldValue = NULL;
@@ -801,7 +783,7 @@ Loaded includes:
         * @return      $isSet          Whether the given field name is set
         * @throws      NullPointerException    If the result instance is null
         * @throws      InvalidArgumentException        If a parameter is not valid
-        * @deprecated  Monolithic method, should be moved to proper classes
+        * @deprecated  Monolithic method, should be avoided by using DatabaseResult classes instead
         */
        public function isFieldSet (string $fieldName): bool {
                // Check parameter
@@ -812,7 +794,7 @@ Loaded includes:
                }
 
                // This method is deprecated
-               $this->deprecationWarning('Monolithic method, should be moved to proper classes');
+               $this->deprecationWarning('Monolithic method, should be avoided by using DatabaseResult classes instead');
 
                // Get result instance
                $resultInstance = $this->getResultInstance();
@@ -952,29 +934,6 @@ Loaded includes:
                return $hasSlept;
        }
 
-       /**
-        * Checks whether the given encoded data was encoded with Base64
-        *
-        * @param       $encodedData    Encoded data we shall check
-        * @return      $isBase64               Whether the encoded data is Base64
-        * @throws      InvalidArgumentException        If a parameter is not valid
-        */
-       protected function isBase64Encoded (string $encodedData): bool {
-               // Check parameter
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: encodedData=%s - CALLED!', $encodedData));
-               if (empty($encodedData)) {
-                       // Throw IAE
-                       throw new InvalidArgumentException('Parameter "encodedData" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
-               }
-
-               // Determine it
-               $isBase64 = (@base64_decode($encodedData, true) !== false);
-
-               // Return it
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: isBase64=%d - EXIT!', intval($isBase64)));
-               return $isBase64;
-       }
-
        /**
         * Getter for startup time in miliseconds
         *
index a5ad4710bb57103b2ef3b90c24b3f313b07e1921..0bce293fabf6137f3a936a6651a1f29e65c11947 100644 (file)
@@ -532,4 +532,27 @@ final class StringUtils extends BaseFrameworkSystem {
                return $ret;
        }
 
+       /**
+        * Checks whether the given encoded data was encoded with Base64
+        *
+        * @param       $encodedData    Encoded data we shall check
+        * @return      $isBase64               Whether the encoded data is Base64
+        * @throws      InvalidArgumentException        If a parameter is not valid
+        */
+       public static function isBase64Encoded (string $encodedData): bool {
+               // Check parameter
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: encodedData=%s - CALLED!', $encodedData));
+               if (empty($encodedData)) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "encodedData" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
+               }
+
+               // Determine it
+               $isBase64 = (@base64_decode($encodedData, true) !== false);
+
+               // Return it
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: isBase64=%d - EXIT!', intval($isBase64)));
+               return $isBase64;
+       }
+
 }
index 8c1003d51581b1297578dd9c3092bd8e8ddbefac..792ef7c4b627c59af99c0ce7913679217d6dd7fc 100644 (file)
@@ -44,7 +44,7 @@ interface FrameworkInterface {
         * @return      $fieldValue             Field value from the user
         * @throws      NullPointerException    If the result instance is null
         */
-       function getField (string $fieldName);
+       function getField (string $fieldName): mixed;
 
        /**
         * Checks if given field is set
@@ -53,7 +53,7 @@ interface FrameworkInterface {
         * @return      $isSet          Whether the given field name is set
         * @throws      NullPointerException    If the result instance is null
         */
-       function isFieldSet (string $fieldName);
+       function isFieldSet (string $fieldName): bool;
 
        /**
         * Setter for call-back instance
@@ -61,7 +61,7 @@ interface FrameworkInterface {
         * @param       $callbackInstance       An instance of a FrameworkInterface class
         * @return      void
         */
-       function setCallbackInstance (FrameworkInterface $callbackInstance);
+       function setCallbackInstance (FrameworkInterface $callbackInstance): void;
 
        /**
         * Checks whether an object equals this object. You should overwrite this
@@ -70,13 +70,13 @@ interface FrameworkInterface {
         * @param       $objectInstance         An instance of a FrameworkInterface object
         * @return      $equals                         Whether both objects equals
         */
-       function equals (FrameworkInterface $objectInstance);
+       function equals (FrameworkInterface $objectInstance): bool;
 
        /**
         * Generates a code for hashes from this class
         *
         * @return      $hashCode       The hash code respresenting this class
         */
-       function hashCode ();
+       function hashCode (): int;
 
 }
index fc514b72f57933604b45b469bff9999765fb11fb..ba296116cae27010b50f6e5b70fd62069aca0ed8 100644 (file)
@@ -95,12 +95,4 @@ interface Listable extends FrameworkInterface, IteratorAggregate {
         */
        function clearList (): void;
 
-       /**
-        * Setter for call-back instance
-        *
-        * @param       $callbackInstance       An instance of a FrameworkInterface class
-        * @return      void
-        */
-       function setCallbackInstance (FrameworkInterface $callbackInstance): void;
-
 }