// Calculate header size
$this->setHeaderSize(
strlen(self::INDEX_MAGIC) +
- strlen(chr(self::SEPARATOR_HEADER_DATA)) +
+ strlen(chr(BaseFile::SEPARATOR_HEADER_DATA)) +
self::LENGTH_COUNT +
- strlen(chr(self::SEPARATOR_HEADER_ENTRIES))
+ strlen(chr(BaseFile::SEPARATOR_HEADER_ENTRIES))
);
// Init counters and gaps array
// Last character must be the separator
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] data(-1)=%s', __METHOD__, __LINE__, dechex(ord(substr($data, -1, 1)))));
- assert(substr($data, -1, 1) == chr(self::SEPARATOR_HEADER_ENTRIES));
+ assert(substr($data, -1, 1) == chr(BaseFile::SEPARATOR_HEADER_ENTRIES));
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
// Okay, then remove it
* 0 => magic
* 1 => total entries
*/
- $header = explode(chr(self::SEPARATOR_HEADER_DATA), $data);
+ $header = explode(chr(BaseFile::SEPARATOR_HEADER_DATA), $data);
// Set it here
$this->setHeader($header);
self::INDEX_MAGIC,
// Separator header data
- chr(self::SEPARATOR_HEADER_DATA),
+ chr(BaseFile::SEPARATOR_HEADER_DATA),
// Total entries
str_pad($this->dec2hex($this->getCounter()), self::LENGTH_COUNT, '0', STR_PAD_LEFT),
// Separator header<->entries
- chr(self::SEPARATOR_HEADER_ENTRIES)
+ chr(BaseFile::SEPARATOR_HEADER_ENTRIES)
);
// Write it to disk (header is always at seek position 0)
*/
public function calculateMinimumBlockLength () {
// Calulcate it
- $length = self::LENGTH_TYPE + strlen(chr(self::SEPARATOR_TYPE_POSITION)) + self::LENGTH_POSITION + strlen(chr(self::SEPARATOR_ENTRIES));
+ $length = self::LENGTH_TYPE + strlen(chr(BaseFile::SEPARATOR_TYPE_POSITION)) + self::LENGTH_POSITION + strlen(chr(BaseFile::SEPARATOR_ENTRIES));
// Return it
return $length;
// Calculate header size
$this->setHeaderSize(
strlen(self::STACK_MAGIC) +
- strlen(chr(self::SEPARATOR_HEADER_DATA)) +
+ strlen(chr(BaseFile::SEPARATOR_HEADER_DATA)) +
self::LENGTH_COUNT +
- strlen(chr(self::SEPARATOR_HEADER_DATA)) +
+ strlen(chr(BaseFile::SEPARATOR_HEADER_DATA)) +
self::LENGTH_POSITION +
- strlen(chr(self::SEPARATOR_HEADER_ENTRIES))
+ strlen(chr(BaseFile::SEPARATOR_HEADER_ENTRIES))
);
// Init counters and gaps array
// Last character must be the separator
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] data(-1)=%s', __METHOD__, __LINE__, dechex(ord(substr($data, -1, 1)))));
- assert(substr($data, -1, 1) == chr(self::SEPARATOR_HEADER_ENTRIES));
+ assert(substr($data, -1, 1) == chr(BaseFile::SEPARATOR_HEADER_ENTRIES));
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
// Okay, then remove it
* 1 => total entries
* 2 => current seek position
*/
- $header = explode(chr(self::SEPARATOR_HEADER_DATA), $data);
+ $header = explode(chr(BaseFile::SEPARATOR_HEADER_DATA), $data);
// Set header here
$this->setHeader($header);
self::STACK_MAGIC,
// Separator magic<->count
- chr(self::SEPARATOR_HEADER_DATA),
+ chr(BaseFile::SEPARATOR_HEADER_DATA),
// Total entries (will be zero) and pad it to 20 chars
str_pad($this->dec2hex($this->getCounter()), self::LENGTH_COUNT, '0', STR_PAD_LEFT),
// Separator count<->seek position
- chr(self::SEPARATOR_HEADER_DATA),
+ chr(BaseFile::SEPARATOR_HEADER_DATA),
// Position (will be zero)
str_pad($this->dec2hex($this->getSeekPosition(), 2), self::LENGTH_POSITION, '0', STR_PAD_LEFT),
// Separator position<->entries
- chr(self::SEPARATOR_HEADER_ENTRIES)
+ chr(BaseFile::SEPARATOR_HEADER_ENTRIES)
);
// Write it to disk (header is always at seek position 0)
*/
public function calculateMinimumBlockLength () {
// Calulcate it
- $length = self::getHashLength() + strlen(chr(self::SEPARATOR_HASH_NAME)) + self::LENGTH_NAME + 1 + strlen(chr(self::SEPARATOR_ENTRIES));
+ $length = self::getHashLength() + strlen(chr(BaseFile::SEPARATOR_HASH_NAME)) + self::LENGTH_NAME + 1 + strlen(chr(BaseFile::SEPARATOR_ENTRIES));
// Return it
return $length;