* @return $isset Whether the given key is set
*/
protected final function isGenericArrayElementSet (string $keyGroup, string $subGroup, $key, $element) {
- // Debug message
- //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element);
-
// Is it there?
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element);
$isset = isset($this->genericArray[$keyGroup][$subGroup][$key][$element]);
// Return it
* @return $isset Whether the given key is set
*/
protected final function isGenericArrayKeySet (string $keyGroup, string $subGroup, $key) {
- // Debug message
- //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key);
-
// Is it there?
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key);
$isset = isset($this->genericArray[$keyGroup][$subGroup][$key]);
// Return it
* @return $isset Whether the given group is set
*/
protected final function isGenericArrayGroupSet (string $keyGroup, string $subGroup) {
- // Debug message
- //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup);
-
// Is it there?
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup);
$isset = isset($this->genericArray[$keyGroup][$subGroup]);
// Return it
exit;
}
- // Debug message
- //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',value=' . print_r($this->genericArray[$keyGroup][$subGroup], true));
-
// Return it
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',value=' . print_r($this->genericArray[$keyGroup][$subGroup], true));
return $this->genericArray[$keyGroup][$subGroup];
}
* @return void
*/
protected final function unsetGenericArrayKey (string $keyGroup, string $subGroup, $key) {
- // Debug message
- //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key);
-
// Remove it
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key);
unset($this->genericArray[$keyGroup][$subGroup][$key]);
}
$header = explode(chr(BinaryFile::SEPARATOR_HEADER_DATA), $data);
// Map numeric entries to associative (alpha-numeric) elements
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-INDEX: HEADER_INDEX_ELEMENT_COUNT=%d,header()=%d', BinaryFile::HEADER_INDEX_ELEMENT_COUNT, count($header)));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-INDEX: Calling ArrayUtils::mapNumericKeysToAssociative(%d) ...', count($header)));
//* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-INDEX: header(%d)=%s', count($header), print_r($header, true)));
$header = ArrayUtils::mapNumericKeysToAssociative($header, [
BinaryFile::HEADER_NAME_MAGIC,
]);
// Check if the array has only 2 elements
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-INDEX: HEADER_INDEX_ELEMENT_COUNT=%d,header()=%d', BinaryFile::HEADER_INDEX_ELEMENT_COUNT, count($header)));
if (count($header) != BinaryFile::HEADER_INDEX_ELEMENT_COUNT) {
// Bad header
throw new UnexpectedValueException(sprintf('header()=%d is not expected value %d', count($header), BinaryFile::HEADER_INDEX_ELEMENT_COUNT));
}
// Last character must be the separator
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: data(-1)=%s', dechex(ord(substr($data, -1, 1)))));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: data(-1)=0x%s', dechex(ord(substr($data, -1, 1)))));
if (substr($data, -1, 1) !== chr(BinaryFile::SEPARATOR_HEADER_ENTRIES)) {
// Not valid separator
- throw new UnexpectedValueException(sprintf('data=%s does not have separator=%s at the end.',
+ throw new UnexpectedValueException(sprintf('data=%s does not have separator=0x%s at the end.',
$data,
- BinaryFile::SEPARATOR_HEADER_ENTRIES
+ dechex(BinaryFile::SEPARATOR_HEADER_ENTRIES)
));
}
$header = explode(chr(BinaryFile::SEPARATOR_HEADER_DATA), $data);
// Map numeric indexes to associative indexes
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: header()=%d', count($header)));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Calling ArrayUtils::mapNumericKeysToAssociative(%d) ...', count($header)));
$header = ArrayUtils::mapNumericKeysToAssociative($header, [
BinaryFile::HEADER_NAME_MAGIC,
BinaryFile::HEADER_NAME_TOTAL_ENTRIES,