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;
]);
// 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,