Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 3 Dec 2020 20:48:15 +0000 (21:48 +0100)
committerRoland Häder <roland@mxchange.org>
Thu, 3 Dec 2020 20:48:15 +0000 (21:48 +0100)
- logging __METHOD__ + __LINE__ again is no more needed since rewrite of logger
- possible fix for wrong valid() result (was FALSE while there was one entry
  there)

Signed-off-by: Roland Häder <roland@mxchange.org>
framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/database/result/class_CachedDatabaseResult.php
framework/main/classes/file_directories/binary/index/class_IndexFile.php
framework/main/classes/file_directories/binary/stack/class_StackFile.php
framework/main/classes/file_directories/text/class_BaseTextFile.php
framework/main/classes/helper/class_BaseHelper.php
framework/main/classes/output/console/class_ConsoleOutput.php
framework/main/classes/output/debug/console/class_DebugConsoleOutput.php
framework/main/classes/output/debug/error/class_DebugErrorLogOutput.php
framework/main/classes/output/debug/web/class_DebugWebOutput.php
framework/main/classes/output/web/class_WebOutput.php

index 6280c51517baf79ba8460022e22ec6aa36cb887d..f1c3b49a342ae3bdb4fb4c11bb96f9863b72ce4c 100644 (file)
@@ -831,10 +831,10 @@ Loaded includes:
                        $fieldValue = $fieldArray[$fieldName2];
                } elseif (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled')) {
                        // Missing field entry, may require debugging
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']:fieldArray<pre>=' . print_r($fieldArray, true) . '</pre>,fieldName=' . $fieldName . ' not found!');
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FRAMEWORK-SYSTEM: fieldArray<pre>=' . print_r($fieldArray, true) . '</pre>,fieldName=' . $fieldName . ' not found!');
                } else {
                        // Missing field entry, may require debugging
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']:fieldName=' . $fieldName . ' not found!');
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FRAMEWORK-SYSTEM: fieldName=' . $fieldName . ' not found!');
                }
 
                // Return it
index 56a6afcc562245dbca077697c96e6070521693b2..2d869894a6d7e3c08ef855654dd13d7ff5bf2db0 100644 (file)
@@ -206,17 +206,9 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
         * @return      $isValid Whether the next/rewind entry is valid
         */
        public function valid () {
-               // By default nothing is valid
-               $isValid = false;
-
-               // Debug message
-               //*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] this->currentPos=' . $this->currentPos);
-
                // Check if all is fine ...
-               if (($this->ifStatusIsOkay()) && (isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS][($this->currentPos + 1)])) && (isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS][0]))) {
-                       // All fine!
-                       $isValid = true;
-               }
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CACHED-DATABASE-RESULT: this->currentPos=' . $this->currentPos);
+               $isValid = ($this->ifStatusIsOkay() && isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS][$this->currentPos]) && isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS][0]));
 
                // Return the result
                return $isValid;
@@ -238,8 +230,8 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
         * @return      $ifStatusOkay   Whether the status of the query was okay
         */
        public function ifStatusIsOkay () {
-               $ifStatusOkay = ((isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_STATUS])) && ($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_STATUS] === BaseDatabaseBackend::RESULT_OKAY));
-               //*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] ifStatusOkay=' . intval($ifStatusOkay));
+               $ifStatusOkay = (isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_STATUS]) && $this->resultArray[BaseDatabaseBackend::RESULT_INDEX_STATUS] === BaseDatabaseBackend::RESULT_OKAY);
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CACHED-DATABASE-RESULT: ifStatusOkay=' . intval($ifStatusOkay));
                return $ifStatusOkay;
        }
 
@@ -258,7 +250,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
         * @return      void
         */
        public function rewind () {
-               $this->currentPos = -1;
+               $this->currentPos = 0;
                $this->currentRow = [];
        }
 
index cca972d1899cdbb3a7f650969d259ece9b499fc8..6bcf23bbc260c0196b92649ffca65022a05f91f7 100644 (file)
@@ -78,7 +78,7 @@ class IndexFile extends BaseBinaryFile implements Block {
         * @throws      UnsupportedOperationException   If this method is called
         */
        public function writeValueToFile (string $groupId, $value) {
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] groupId=' . $groupId . ',value[' . gettype($value) . ']=' . print_r($value, true));
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('INDEX-FILE: groupId=' . $groupId . ',value[' . gettype($value) . ']=' . print_r($value, true));
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
@@ -92,7 +92,7 @@ class IndexFile extends BaseBinaryFile implements Block {
         * @throws      UnsupportedOperationException   If this method is called
         */
        public function writeDataToFreeGap (string $groupId, string $hash, string $encoded) {
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] groupId=' . $groupId . ',encoded()=' . strlen($encoded));
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('INDEX-FILE: groupId=' . $groupId . ',encoded()=' . strlen($encoded));
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
index f1422cf9a25e509783aa7f55b7c4bd8127c924a4..d63af06daf8024a7a0ce1932d7e3e3be8acdc893 100644 (file)
@@ -100,7 +100,7 @@ class StackFile extends BaseBinaryFile implements Block {
         * @throws      UnsupportedOperationException   If this method is called
         */
        public function writeDataToFreeGap (string $groupId, string $hash, string $encoded) {
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] groupId=' . $groupId . ',hash=' . $hash . ',encoded()=' . strlen($encoded));
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('STACK-FILE: groupId=' . $groupId . ',hash=' . $hash . ',encoded()=' . strlen($encoded));
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
index 2f07a57a20a1d65b1cb6f077cec8e9c744faa440..901b70b379975a5b0a4bb835cfc601b1b748d661 100644 (file)
@@ -62,7 +62,7 @@ abstract class BaseTextFile extends BaseAbstractFile {
         */
        public function seek ($offset, $whence = SEEK_SET) {
                // Not possible in text files
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] offset=' . $offset . ',whence=' . $whence);
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEXT-FILE: offset=' . $offset . ',whence=' . $whence);
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
@@ -79,7 +79,7 @@ abstract class BaseTextFile extends BaseAbstractFile {
                 * This class (or its implementations) are special file readers/writers.
                 * There is no need to read/write the whole file.
                 */
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] infoInstance=' . $infoInstance);
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEXT-FILE: infoInstance=' . $infoInstance);
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
index 994988e59efa96f70fedeebb72d2f03124e3d049..67cd01e89179e2102a6dbc1424283e18ddf5b4f0 100644 (file)
@@ -486,8 +486,8 @@ abstract class BaseHelper extends BaseFrameworkSystem {
                        //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput($fieldName.'[]='.gettype($fieldValue).'('.strlen($fieldValue).') - Extra instance!');
                } else {
                        // Field is not set
-                       $this->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] fieldName=' . $fieldName . ' is not set! - @TODO');
-               } // END - if
+                       $this->debugOutput('BASE-HELPER: fieldName=' . $fieldName . ' is not set! - @TODO');
+               }
 
                // Return it
                return $fieldValue;
index 9f117ead9abc7be2761054872d60a92794297113..3debd0f0bb9ecb336f76fd88a339071b6b071e7e 100644 (file)
@@ -119,7 +119,7 @@ class ConsoleOutput extends BaseOutput implements OutputStreamer {
         * @throws      UnsupportedOperationException   If this method is called
         */
        public function seek ($offset, $whence = SEEK_SET) {
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] offset=' . $offset . ',whence=' . $whence);
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONSOLE-OUTPUT: offset=' . $offset . ',whence=' . $whence);
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
index 2f8297f9ea0416d1bf937039ab3ec03621fc6728..eeaa83943a1dd62b9df373c7a4194ea0137e470e 100644 (file)
@@ -125,7 +125,7 @@ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStre
         * @throws      UnsupportedOperationException   If this method is called
         */
        public function seek ($offset, $whence = SEEK_SET) {
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] offset=' . $offset . ',whence=' . $whence);
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DEBUG-CONSOLE-OUTPUT: offset=' . $offset . ',whence=' . $whence);
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
index 495f8f71358f9ed449e247a3c4aa576012895989..dea301530e67f959d5fc6252ffd120133902dc4b 100644 (file)
@@ -123,7 +123,7 @@ class DebugErrorLogOutput extends BaseDebugOutput implements Debugger, OutputStr
         * @throws      UnsupportedOperationException   If this method is called
         */
        public function seek ($offset, $whence = SEEK_SET) {
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] offset=' . $offset . ',whence=' . $whence);
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DEBUG-ERROR-LOG-OUTPUT: offset=' . $offset . ',whence=' . $whence);
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
index 10868cd8b0af4ec6aaa5cecdc17dbc4f10cd386d..6e448d7dda9f3eeec2f9a7f90f2b8bef951d73fa 100644 (file)
@@ -112,7 +112,7 @@ class DebugWebOutput extends BaseDebugOutput implements Debugger, OutputStreamer
         * @throws      UnsupportedOperationException   If this method is called
         */
        public function seek ($offset, $whence = SEEK_SET) {
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] offset=' . $offset . ',whence=' . $whence);
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DEBUG-WEB-OUTPUT: offset=' . $offset . ',whence=' . $whence);
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
index 89f8d0550b41f6ff2ed5f54ffd242f3cce8abea6..d9c8ac692dc5cecb37455fdebdb49964df51dbbe 100644 (file)
@@ -105,7 +105,7 @@ class WebOutput extends BaseOutput implements OutputStreamer, Registerable {
         * @throws      UnsupportedOperationException   If this method is called
         */
        public function seek ($offset, $whence = SEEK_SET) {
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] offset=' . $offset . ',whence=' . $whence);
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('WEB-OUTPUT: offset=' . $offset . ',whence=' . $whence);
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }