* @return void
*/
protected function partialStub ($message = '') {
- // Get the backtrace
- $backtrace = debug_backtrace();
-
- // Generate the class::method string
- $methodName = 'UnknownClass->unknownMethod';
- if ((isset($backtrace[1]['class'])) && (isset($backtrace[1]['function']))) {
- $methodName = $backtrace[1]['class'] . '->' . $backtrace[1]['function'];
- } // END - if
-
- // Construct the full message
- $stubMessage = sprintf('[%s]: Partial stub!',
- $methodName
- );
+ // Init variable
+ $stubMessage = 'Partial Stub!';
// Is the extra message given?
if (!empty($message)) {
// Empty string should be ignored and used for testing the middleware
DebugMiddleware::getSelfInstance()->output('');
- // Set it in its own class. This will set it in the registry
- $debugInstance->setDebugInstance($debugInstance);
+ // Set it in registry
+ Registry::getRegistry()->addInstance('debug', $debugInstance);
} else {
// Get instance from registry
- $debugInstance = Registry::getRegistry()->getDebugInstance();
+ $debugInstance = Registry::getRegistry()->getInstance('debug');
}
// Return it
// Set debug instance to NULL
$debugInstance = NULL;
+ // Get backtrace
+ $backtrace = debug_backtrace(!DEBUG_BACKTRACE_PROVIDE_OBJECT);
+
+ // Is function 'partialStub' ?
+ if ($backtrace[1]['function'] == 'partialStub') {
+ // Prepend class::function:line from 3rd element
+ $message = sprintf('[%s::%s:%d]: %s',
+ $backtrace[2]['class'],
+ $backtrace[2]['function'],
+ (isset($backtrace[2]['line']) ? $backtrace[2]['line'] : '0'),
+ $message
+ );
+ } else {
+ // Prepend class::function:line from 2nd element
+ $message = sprintf('[%s::%s:%d]: %s',
+ $backtrace[1]['class'],
+ $backtrace[1]['function'],
+ (isset($backtrace[1]['line']) ? $backtrace[1]['line'] : '0'),
+ $message
+ );
+ }
+
// Try it:
try {
// Get debug instance