Added assert() + noisy debug line + fixed double-implementation of an interface.
authorRoland Haeder <roland@mxchange.org>
Fri, 23 May 2014 23:43:17 +0000 (01:43 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 23 May 2014 23:43:17 +0000 (01:43 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
inc/classes/main/index/file_stack/class_FileStackIndex.php
inc/classes/main/iterator/io/class_FileIoIterator.php

index ebd5fe25dcee457de8038f31d46bf4a60beb0cd0..3df30f84f67c12397b95468fd774bfbbc614031b 100644 (file)
@@ -21,7 +21,7 @@
  * 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 FileStackIndex extends BaseIndex implements IndexableStack, CalculatableBlock, Registerable {
+class FileStackIndex extends BaseIndex implements IndexableStack, Registerable {
        /**
         * Protected constructor
         *
index 9ef4801d2a25dc6ab807492ea9c4744b3056afc6..ba1019ab0385f37c54fef80ba51043374c0a21d4 100644 (file)
@@ -150,7 +150,7 @@ class FileIoIterator extends BaseIterator implements SeekableWritableFileIterato
 
                // Wait until a entry/block separator has been found
                $data = $this->getBackBuffer();
-               while (($this->getPointerInstance()->isEndOfFileReached()) && (!$this->getBlockInstance()->isBlockSeparatorFound($data))) {
+               while ((!$this->getPointerInstance()->isEndOfFileReached()) && (!$this->getBlockInstance()->isBlockSeparatorFound($data))) {
                        // Then read the block
                        $data .= $this->read($length);
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('data()=' . strlen($data));
@@ -159,6 +159,7 @@ class FileIoIterator extends BaseIterator implements SeekableWritableFileIterato
                // EOF reached?
                if ($this->getPointerInstance()->isEndOfFileReached()) {
                        // Then abort here silently
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('EOF reached.');
                        return;
                } // END - if
 
@@ -171,6 +172,10 @@ class FileIoIterator extends BaseIterator implements SeekableWritableFileIterato
                // Separate data
                $dataArray = explode(self::getBlockSeparator(), $data);
 
+               // This array must contain two elements
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('dataArray=' . print_r($dataArray, TRUE));
+               assert(count($dataArray) == 2);
+
                // Left part is the actual block, right one the back-buffer data
                $this->setCurrentBlock($dataArray[0]);
                $this->setBackBuffer($dataArray[1]);