+ // Get backtrace
+ $backtrace = debug_backtrace(!DEBUG_BACKTRACE_PROVIDE_OBJECT);
+
+ // Is function partialStub/__callStatic ?
+ if (in_array($backtrace[1]['function'], array('partialStub', '__call', '__callStatic'))) {
+ // 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
+ );
+ }
+