]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/stacker/file/class_BaseFileStack.php
Continued:
[core.git] / framework / main / classes / stacker / file / class_BaseFileStack.php
index 59aac997e63e6925c4233c9e0dd48d33d9f47325..0a2ca5ce2f4aab2176823f43ead80463cfaa27c8 100644 (file)
@@ -11,8 +11,8 @@ use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
 use Org\Mxchange\CoreFramework\Stack\BaseStacker;
 use Org\Mxchange\CoreFramework\Traits\Index\IndexableTrait;
 use Org\Mxchange\CoreFramework\Traits\Iterator\IteratorTrait;
-use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils;
 use Org\Mxchange\CoreFramework\Utils\Arrays\ArrayUtils;
+use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils;
 
 // Import SPL stuff
 use \InvalidArgumentException;
@@ -135,21 +135,18 @@ abstract class BaseFileStack extends BaseStacker {
                ]);
 
                // Check if the array has only 3 elements
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: HEADER_ELEMENT_COUNT=%d,header(%d)=%s', BinaryFile::HEADER_ELEMENT_COUNT, count($header), print_r($header, true)));
-               if (count($header) != BinaryFile::HEADER_ELEMENT_COUNT) {
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: HEADER_STACK_ELEMENT_COUNT=%d,header(%d)=%s', BinaryFile::HEADER_STACK_ELEMENT_COUNT, count($header), print_r($header, true)));
+               if (count($header) != BinaryFile::HEADER_STACK_ELEMENT_COUNT) {
                        // Header array count is not expected
                        throw new UnexpectedValueException(sprintf('data=%s has %d elements, but expected is %d',
                                $data,
                                count($header),
-                               BinaryFile::HEADER_ELEMENT_COUNT
+                               BinaryFile::HEADER_STACK_ELEMENT_COUNT
                        ));
                } elseif ($header[BinaryFile::HEADER_NAME_MAGIC] != StackableFile::STACK_MAGIC) {
                        // Bad magic
                        throw new InvalidMagicException($data, self::EXCEPTION_BAD_MAGIC);
-               }
-
-               // Check length of count and seek position
-               if (strlen($header[BinaryFile::HEADER_NAME_TOTAL_ENTRIES]) != BinaryFile::LENGTH_COUNT) {
+               } elseif (strlen($header[BinaryFile::HEADER_NAME_TOTAL_ENTRIES]) != BinaryFile::LENGTH_COUNT) {
                        // Count length not valid
                        throw new UnexpectedValueException(sprintf('header[%s](%d)=%s is not expected %d length',
                                BinaryFile::HEADER_NAME_TOTAL_ENTRIES,