// Output stub message
// @TODO __CLASS__ does always return BaseFrameworkSystem but not the extending (=child) class
- self::createDebugInstance(__CLASS__)->debugOutput(sprintf("[unknown::%s:] Stub! Args: %s",
+ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[unknown::%s:] Stub! Args: %s',
$methodName,
$argsString
));
* @return void
*/
public final function __set ($name, $value) {
- $this->debugBackTrace(sprintf("Tried to set a missing field. name=%s, value[%s]=%s",
+ $this->debugBackTrace(sprintf('Tried to set a missing field. name=%s, value[%s]=%s',
$name,
gettype($value),
$value
* @return void
*/
public final function __get ($name) {
- $this->debugBackTrace(sprintf("Tried to get a missing field. name=%s",
+ $this->debugBackTrace(sprintf('Tried to get a missing field. name=%s',
$name
));
}
* @return void
*/
public final function __unset ($name) {
- $this->debugBackTrace(sprintf("Tried to unset a missing field. name=%s",
+ $this->debugBackTrace(sprintf('Tried to unset a missing field. name=%s',
$name
));
}
// Is a message set?
if (!empty($message)) {
// Construct message
- $content = sprintf("<div class=\"debug_message\">Message: %s</div>\n", $message);
+ $content = sprintf('<div class="debug_message">Message: %s</div>' . PHP_EOL, $message);
} // END - if
// Generate the output
- $content .= sprintf("<pre>%s</pre>",
+ $content .= sprintf('<pre>%s</pre>',
trim(
htmlentities(
print_r($this, true)
);
// Output it
- ApplicationEntryPoint::app_exit(sprintf("<div class=\"debug_header\">%s debug output:</div><div class=\"debug_content\">%s</div>\nLoaded includes: <div class=\"debug_include_list\">%s</div>",
+ ApplicationEntryPoint::app_exit(sprintf('<div class="debug_header">%s debug output:</div><div class="debug_content">%s</div>Loaded includes: <div class="debug_include_list">%s</div>',
$this->__toString(),
$content,
ClassLoader::getSelfInstance()->getPrintableIncludeList()
return $debugInstance;
}
+ /**
+ * Simple output of a message with line-break
+ *
+ * @param $message Message to output
+ * @return void
+ */
+ public function outputLine ($message) {
+ // Simply output it
+ print($message . PHP_EOL);
+ }
+
/**
* Outputs a debug message whether to debug instance (should be set!) or
* dies with or ptints the message. Do NEVER EVER rewrite the exit() call to
// Put directly out
if ($doPrint === TRUE) {
// Print message
- print($message . chr(10));
+ $this->outputLine($message);
} else {
// Die here
exit($message);
* @return $isset Whether the given key is set
*/
protected final function isGenericArrayElementSet ($keyGroup, $subGroup, $key, $element) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element);
+
// Is it there?
$isset = isset($this->genericArray[$keyGroup][$subGroup][$key][$element]);
* @return $isset Whether the given key is set
*/
protected final function isGenericArrayKeySet ($keyGroup, $subGroup, $key) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key);
+
// Is it there?
$isset = isset($this->genericArray[$keyGroup][$subGroup][$key]);
* @return $isset Whether the given group is set
*/
protected final function isGenericArrayGroupSet ($keyGroup, $subGroup) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup);
+
// Is it there?
$isset = isset($this->genericArray[$keyGroup][$subGroup]);
trigger_error(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ' not found.');
} // END - if
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',value=' . print_r($this->genericArray[$keyGroup][$subGroup], TRUE));
+
// Return it
- //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ' returning!' . PHP_EOL);
return $this->genericArray[$keyGroup][$subGroup];
}
* @return void
*/
protected final function unsetGenericArrayKey ($keyGroup, $subGroup, $key) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key);
+
// Remove it
- //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ' unset!' . PHP_EOL);
unset($this->genericArray[$keyGroup][$subGroup][$key]);
}
* @return void
*/
protected final function unsetGenericArrayElement ($keyGroup, $subGroup, $key, $element) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element);
+
// Remove it
- //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ' unset!' . PHP_EOL);
unset($this->genericArray[$keyGroup][$subGroup][$key][$element]);
}
* @param $value Value to add/append
* @return void
*/
- protected final function appendStringToGenericArrayElement ($keyGroup, $subGroup, $key, $value, $appendGlue = '') {
+ protected final function appendStringToGenericArrayKey ($keyGroup, $subGroup, $key, $value, $appendGlue = '') {
+ // Debug message
+ //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, TRUE) . ',appendGlue=' . $appendGlue);
+
// Is it already there?
if ($this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) {
// Append it
}
/**
- * Initializes given generic array
+ * Append a string to a given generic array element
+ *
+ * @param $keyGroup Main group for the key
+ * @param $subGroup Sub group for the key
+ * @param $key Key to unset
+ * @param $element Element to check
+ * @param $value Value to add/append
+ * @return void
+ */
+ protected final function appendStringToGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value, $appendGlue = '') {
+ // Debug message
+ //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, TRUE) . ',appendGlue=' . $appendGlue);
+
+ // Is it already there?
+ if ($this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element)) {
+ // Append it
+ $this->genericArray[$keyGroup][$subGroup][$key][$element] .= $appendGlue . (string) $value;
+ } else {
+ // Add it
+ $this->genericArray[$keyGroup][$subGroup][$key][$element] = (string) $value;
+ }
+ }
+
+ /**
+ * Initializes given generic array group
+ *
+ * @param $keyGroup Main group for the key
+ * @param $subGroup Sub group for the key
+ * @param $key Key to use
+ * @param $forceInit Optionally force initialization
+ * @return void
+ */
+ protected final function initGenericArrayGroup ($keyGroup, $subGroup, $forceInit = FALSE) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',forceInit=' . intval($forceInit));
+
+ // Is it already set?
+ if (($forceInit === FALSE) && ($this->isGenericArrayGroupSet($keyGroup, $subGroup))) {
+ // Already initialized
+ trigger_error(__METHOD__ . ':keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ' already initialized.');
+ } // END - if
+
+ // Initialize it
+ $this->genericArray[$keyGroup][$subGroup] = array();
+ }
+
+ /**
+ * Initializes given generic array key
*
* @param $keyGroup Main group for the key
* @param $subGroup Sub group for the key
* @return void
*/
protected final function initGenericArrayKey ($keyGroup, $subGroup, $key, $forceInit = FALSE) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',forceInit=' . intval($forceInit));
+
// Is it already set?
if (($forceInit === FALSE) && ($this->isGenericArrayKeySet($keyGroup, $subGroup, $key))) {
// Already initialized
} // END - if
// Initialize it
- //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . PHP_EOL);
$this->genericArray[$keyGroup][$subGroup][$key] = array();
}
+ /**
+ * Initializes given generic array element
+ *
+ * @param $keyGroup Main group for the key
+ * @param $subGroup Sub group for the key
+ * @param $key Key to use
+ * @param $element Element to use
+ * @param $forceInit Optionally force initialization
+ * @return void
+ */
+ protected final function initGenericArrayElement ($keyGroup, $subGroup, $key, $element, $forceInit = FALSE) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',forceInit=' . intval($forceInit));
+
+ // Is it already set?
+ if (($forceInit === FALSE) && ($this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element))) {
+ // Already initialized
+ trigger_error(__METHOD__ . ':keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ' already initialized.');
+ } // END - if
+
+ // Initialize it
+ $this->genericArray[$keyGroup][$subGroup][$key][$element] = array();
+ }
+
/**
* Pushes an element to a generic key
*
* @param $value Value to add/append
* @return $count Number of array elements
*/
- protected final function pushValueToGenericArrayElement ($keyGroup, $subGroup, $key, $value) {
+ protected final function pushValueToGenericArrayKey ($keyGroup, $subGroup, $key, $value) {
+ // Debug message
+ //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, TRUE));
+
// Is it set?
if (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) {
// Initialize array
} // END - if
// Then push it
- //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, TRUE) . PHP_EOL);
$count = array_push($this->genericArray[$keyGroup][$subGroup][$key], $value);
// Return count
return $count;
}
+ /**
+ * Pushes an element to a generic array element
+ *
+ * @param $keyGroup Main group for the key
+ * @param $subGroup Sub group for the key
+ * @param $key Key to use
+ * @param $element Element to check
+ * @param $value Value to add/append
+ * @return $count Number of array elements
+ */
+ protected final function pushValueToGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value) {
+ // Debug message
+ //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, TRUE));
+
+ // Is it set?
+ if (!$this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element)) {
+ // Initialize array
+ $this->initGenericArrayElement($keyGroup, $subGroup, $key, $element);
+ } // END - if
+
+ // Then push it
+ $count = array_push($this->genericArray[$keyGroup][$subGroup][$key][$element], $value);
+
+ // Return count
+ //* DEBUG: */ print(__METHOD__ . ': genericArray=' . print_r($this->genericArray[$keyGroup][$subGroup][$key], TRUE));
+ //* DEBUG: */ print(__METHOD__ . ': count=' . $count . PHP_EOL);
+ return $count;
+ }
+
/**
* Pops an element from a generic group
*
* @return $value Last "popped" value
*/
protected final function popGenericArrayElement ($keyGroup, $subGroup, $key) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key);
+
// Is it set?
if (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) {
// Not found
} // END - if
// Then "pop" it
- //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ' pop-ing entry ...' . PHP_EOL);
$value = array_pop($this->genericArray[$keyGroup][$subGroup][$key]);
// Return value
* @return $value Last "popped" value
*/
protected final function shiftGenericArrayElement ($keyGroup, $subGroup, $key) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key);
+
// Is it set?
if (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) {
// Not found
} // END - if
// Then "shift" it
- //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ' shifting entry ...' . PHP_EOL);
$value = array_shift($this->genericArray[$keyGroup][$subGroup][$key]);
// Return value
//* DEBUG: */ print(__METHOD__ . ': genericArray=' . print_r($this->genericArray[$keyGroup][$subGroup][$key], TRUE));
- //* DEBUG: */ print(__METHOD__ . ': value[' . gettype($value) . ']=' . $value . PHP_EOL);
+ //* DEBUG: */ print(__METHOD__ . ': value[' . gettype($value) . ']=' . print_r($value, TRUE) . PHP_EOL);
return $value;
}
* @return $count Count of given group
*/
protected final function countGenericArray ($keyGroup) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup);
+
// Is it there?
if (!isset($this->genericArray[$keyGroup])) {
// Abort here
// Then count it
$count = count($this->genericArray[$keyGroup]);
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',count=' . $count);
+
// Return it
return $count;
}
* @return $count Count of given group
*/
protected final function countGenericArrayGroup ($keyGroup, $subGroup) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup);
+
// Is it there?
if (!$this->isGenericArrayGroupSet($keyGroup, $subGroup)) {
// Abort here
// Then count it
$count = count($this->genericArray[$keyGroup][$subGroup]);
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',count=' . $count);
+
// Return it
return $count;
}
* @return $count Count of given key
*/
protected final function countGenericArrayElements ($keyGroup, $subGroup, $key) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key);
+
// Is it there?
if (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) {
// Abort here
// Then count it
$count = count($this->genericArray[$keyGroup][$subGroup][$key]);
- //* DEBUG: */ print(__METHOD__ . ':keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',count=' . $count . PHP_EOL);
+
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',count=' . $count);
// Return it
return $count;
* @return $array Whole generic array group
*/
protected final function getGenericArray ($keyGroup) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup);
+
// Is it there?
if (!isset($this->genericArray[$keyGroup])) {
// Then abort here
* @return void
*/
protected final function setGenericArrayKey ($keyGroup, $subGroup, $key, $value) {
+ // Debug message
+ //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, TRUE));
+
// Set value here
$this->genericArray[$keyGroup][$subGroup][$key] = $value;
}
* @return $value Mixed value from generic array element
*/
protected final function getGenericArrayKey ($keyGroup, $subGroup, $key) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key);
+
// Is it there?
if (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) {
// Then abort here
* @return void
*/
protected final function setGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value) {
+ // Debug message
+ //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, TRUE));
+
// Then set it
$this->genericArray[$keyGroup][$subGroup][$key][$element] = $value;
}
* @return $value Mixed value from generic array element
*/
protected final function getGenericArrayElement ($keyGroup, $subGroup, $key, $element) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element);
+
// Is it there?
if (!$this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element)) {
// Then abort here
* @return $isValid Whether given sub group is valid
*/
protected final function isValidGenericArrayGroup ($keyGroup, $subGroup) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup);
+
// Determine it
$isValid = (($this->isGenericArrayGroupSet($keyGroup, $subGroup)) && (is_array($this->getGenericSubArray($keyGroup, $subGroup))));
* @return $isValid Whether given sub group is valid
*/
protected final function isValidGenericArrayKey ($keyGroup, $subGroup, $key) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key);
+
// Determine it
$isValid = (($this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) && (is_array($this->getGenericArrayKey($keyGroup, $subGroup, $key))));