- added debug/trace lines
- pad with zeros only hexadecimal strings that are shorter than $maxLength,
if set
- rewind() does NOT have a returned type, if you count 'void' as a non-type ;-)
*/
public static final function createDefaultIterator (Listable $listInstance) {
// Get new instance
*/
public static final function createDefaultIterator (Listable $listInstance) {
// Get new instance
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DEFAULT-ITERATOR: listInstance=%s - CALLED!', $listInstance));
$iteratorInstance = new DefaultIterator();
// Set the list
$iteratorInstance->setListInstance($listInstance);
// Return the prepared instance
$iteratorInstance = new DefaultIterator();
// Set the list
$iteratorInstance->setListInstance($listInstance);
// Return the prepared instance
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DEFAULT-ITERATOR: iteratorInstance=%s - EXIT!', $iteratorInstance));
return $iteratorInstance;
}
return $iteratorInstance;
}
*/
public function current () {
// Default is null
*/
public function current () {
// Default is null
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('DEFAULT-ITERATOR: CALLED!');
$current = NULL;
// Is the entry valid?
$current = NULL;
// Is the entry valid?
$current = $this->getListInstance()->getEntryByIndex($this->key());
// Return it
$current = $this->getListInstance()->getEntryByIndex($this->key());
// Return it
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DEFAULT-ITERATOR: current[]=%s - EXIT!', gettype($current)));
* @return $indexKey Current key in iteration
*/
public function key () {
* @return $indexKey Current key in iteration
*/
public function key () {
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DEFAULT-ITERATOR: this->indexKey=%d - EXIT!', $this->indexKey));
return $this->indexKey;
}
return $this->indexKey;
}
* @return void
*/
public function next () {
* @return void
*/
public function next () {
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-HANDLER: CALLED!');
* @return void
*/
public function rewind () {
* @return void
*/
public function rewind () {
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-HANDLER: CALLED!');
*/
public function valid () {
// Check for total active peers and if we are not at the end
*/
public function valid () {
// Check for total active peers and if we are not at the end
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-HANDLER: CALLED!');
$isValid = ($this->key() < $this->getListInstance()->count());
// Return result
$isValid = ($this->key() < $this->getListInstance()->count());
// Return result
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FILE-IO-HANDLER: isValid=%d - EXIT!', intval($isValid)));
/**
* Rewinds to the beginning of the file
*
/**
* Rewinds to the beginning of the file
*
- * @return $status Status of this operation
*/
public function rewind () {
// Call file instance
*/
public function rewind () {
// Call file instance
* situations more leading zeros are wanted, so check for both
* conditions.
*/
* situations more leading zeros are wanted, so check for both
* conditions.
*/
+ //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('STRING-UTILS: hex=%s,hex()=%d,maxLength=%d - BEFORE!', $hex, strlen($hex) % 2, $maxLength));
+ if ($maxLength > 0 && strlen($hex) < $maxLength) {
// Prepend more zeros
$hex = str_pad($hex, $maxLength, '0', STR_PAD_LEFT);
} elseif ((strlen($hex) % 2) != 0) {
// Only make string's length dividable by 2
$hex = '0' . $hex;
}
// Prepend more zeros
$hex = str_pad($hex, $maxLength, '0', STR_PAD_LEFT);
} elseif ((strlen($hex) % 2) != 0) {
// Only make string's length dividable by 2
$hex = '0' . $hex;
}
+ //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('STRING-UTILS: hex=%s,hex()=%d - AFTER!', $hex, strlen($hex) % 2));
// Return the hexadecimal string
//* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: sign=%s,hex=%s - EXIT!', $sign, $hex));
// Return the hexadecimal string
//* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: sign=%s,hex=%s - EXIT!', $sign, $hex));
/**
* Rewinds to the beginning of the file
*
/**
* Rewinds to the beginning of the file
*
- * @return $status Status of this operation