*/
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
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DEFAULT-ITERATOR: iteratorInstance=%s - EXIT!', $iteratorInstance));
return $iteratorInstance;
}
*/
public function current () {
// Default is null
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('DEFAULT-ITERATOR: CALLED!');
$current = NULL;
// Is the entry valid?
$current = $this->getListInstance()->getEntryByIndex($this->key());
// Return it
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DEFAULT-ITERATOR: current[]=%s - EXIT!', gettype($current)));
return $current;
}
* @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 void
*/
public function next () {
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-HANDLER: CALLED!');
$this->indexKey++;
}
* @return void
*/
public function rewind () {
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-HANDLER: CALLED!');
$this->indexKey = 0;
}
*/
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
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FILE-IO-HANDLER: isValid=%d - EXIT!', intval($isValid)));
return $isValid;
}
* situations more leading zeros are wanted, so check for both
* conditions.
*/
- if ($maxLength > 0) {
+ //* 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;
}
+ //* 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));