public static function findCaller()
    {
        if (version_compare(PHP_VERSION, '5.3.6', '>=')) {
            $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
        } else {
            $bt = debug_backtrace(false);
        }

        $max    = count($bt);
        $ns     = __NAMESPACE__ . '\\';
        $len    = strlen($ns);
        $ns2    = $ns . 'Tests' . '\\';
        for ($i = 0; $i < $max; $i++) {
            if (isset($bt[$i]['function']) &&
                !strncmp($ns, $bt[$i]['function'], $len) &&
                strncmp($ns2, $bt[$i]['function'], $len + 6)) {
                // Skip frames until we get out of Plop's code.
                continue;
            }

            if (isset($bt[$i]['class']) &&
                !strncmp($ns, $bt[$i]['class'], $len) &&
                strncmp($ns2, $bt[$i]['class'], $len + 6)) {
                // Skip frames until we get out of Plop's code.
                continue;
            }

            break;
        }

        if ($i == $max) {
            return array(
                'ns'    => null,
                'file'  => null,
                'line'  => 0,
                'func'  => null,
                'cls'   => null,
            );
        }

        $ns     = '';
        $func   = isset($bt[$i]['function']) ? $bt[$i]['function'] : null;
        $cls    = isset($bt[$i]['class']) ? $bt[$i]['class'] : null;
        $file   = isset($bt[$i - 1]['file']) ? $bt[$i - 1]['file'] : null;
        $line   = isset($bt[$i - 1]['line']) ? $bt[$i - 1]['line'] : 0;

        if (($pos = strrpos($func, '\\')) !== false) {
            $ns     = substr($func, 0, $pos);
            $func   = substr($func, $pos + 1);
        } elseif (($pos = strrpos($cls, '\\')) !== false) {
            $ns     = substr($cls, 0, $pos);
            $cls    = substr($cls, $pos + 1);
        }

        return array(
            'ns'    => $ns,
            'file'  => $file,
            'line'  => $line,
            'func'  => $func,
            'cls'   => $cls,
        );
    }
public static function findCaller()
    {
        if (version_compare(PHP_VERSION, '5.3.6', '>=')) {
            $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
        } else {
            $bt = debug_backtrace(false);
        }

        $max    = count($bt);
        $ns     = __NAMESPACE__ . '\\';
        $len    = strlen($ns);
        $ns2    = $ns . 'Tests' . '\\';
        for ($i = 0; $i < $max; $i++) {
            if (isset($bt[$i]['function']) &&
                !strncmp($ns, $bt[$i]['function'], $len) &&
                strncmp($ns2, $bt[$i]['function'], $len + 6)) {
                // Skip frames until we get out of Plop's code.
                continue;
            }

            if (isset($bt[$i]['class']) &&
                !strncmp($ns, $bt[$i]['class'], $len) &&
                strncmp($ns2, $bt[$i]['class'], $len + 6)) {
                // Skip frames until we get out of Plop's code.
                continue;
            }

            break;
        }

        if ($i == $max) {
            return array(
                'ns'    => null,
                'file'  => null,
                'line'  => 0,
                'func'  => null,
                'cls'   => null,
            );
        }

        $ns     = '';
        $func   = isset($bt[$i]['function']) ? $bt[$i]['function'] : null;
        $cls    = isset($bt[$i]['class']) ? $bt[$i]['class'] : null;
        $file   = isset($bt[$i - 1]['file']) ? $bt[$i - 1]['file'] : null;
        $line   = isset($bt[$i - 1]['line']) ? $bt[$i - 1]['line'] : 0;

        if (($pos = strrpos($func, '\\')) !== false) {
            $ns     = substr($func, 0, $pos);
            $func   = substr($func, $pos + 1);
        } elseif (($pos = strrpos($cls, '\\')) !== false) {
            $ns     = substr($cls, 0, $pos);
            $cls    = substr($cls, $pos + 1);
        }

        return array(
            'ns'    => $ns,
            'file'  => $file,
            'line'  => $line,
            'func'  => $func,
            'cls'   => $cls,
        );
    }
public static function findCaller ( ) { if ( version_compare ( PHP_VERSION , '5.3.6' , '>=' ) ) { $ bt = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS ) ; } else { $ bt = debug_backtrace ( false ) ; } $ max = count ( $ bt ) ; $ ns = __NAMESPACE__ . '\\' ; $ len = strlen ( $ ns ) ; $ ns2 = $ ns . 'Tests' . '\\' ; for ( $ i = 0 ; $ i < $ max ; $ i ++ ) { if ( isset ( $ bt [ $ i ] [ 'function' ] ) && ! strncmp ( $ ns , $ bt [ $ i ] [ 'function' ] , $ len ) && strncmp ( $ ns2 , $ bt [ $ i ] [ 'function' ] , $ len + 6 ) ) { // Skip frames until we get out of Plop's code. continue ; } if ( isset ( $ bt [ $ i ] [ 'class' ] ) && ! strncmp ( $ ns , $ bt [ $ i ] [ 'class' ] , $ len ) && strncmp ( $ ns2 , $ bt [ $ i ] [ 'class' ] , $ len + 6 ) ) { // Skip frames until we get out of Plop's code. continue ; } break ; } if ( $ i == $ max ) { return array ( 'ns' => null , 'file' => null , 'line' => 0 , 'func' => null , 'cls' => null , ) ; } $ ns = '' ; $ func = isset ( $ bt [ $ i ] [ 'function' ] ) ? $ bt [ $ i ] [ 'function' ] : null ; $ cls = isset ( $ bt [ $ i ] [ 'class' ] ) ? $ bt [ $ i ] [ 'class' ] : null ; $ file = isset ( $ bt [ $ i - 1 ] [ 'file' ] ) ? $ bt [ $ i - 1 ] [ 'file' ] : null ; $ line = isset ( $ bt [ $ i - 1 ] [ 'line' ] ) ? $ bt [ $ i - 1 ] [ 'line' ] : 0 ; if ( ( $ pos = strrpos ( $ func , '\\' ) ) !== false ) { $ ns = substr ( $ func , 0 , $ pos ) ; $ func = substr ( $ func , $ pos + 1 ) ; } elseif ( ( $ pos = strrpos ( $ cls , '\\' ) ) !== false ) { $ ns = substr ( $ cls , 0 , $ pos ) ; $ cls = substr ( $ cls , $ pos + 1 ) ; } return array ( 'ns' => $ ns , 'file' => $ file , 'line' => $ line , 'func' => $ func , 'cls' => $ cls , ) ; }
Return information about the caller of this method.

\retval array
An associative array with information about the caller.
This array always contains the following keys:
-   "ns" -- the name of the caller's namespace.
-   "dir" -- the path to the caller's file.
-   "file" -- the name of the caller's file.
-   "line" -- the line number in that file where the call
was made.
-   "func" -- the name of the function/method where the
call happened.
-   "cls" -- the name of the class where the call was
made.

Each of those values may be null (or 0 in the case of
"line") if the information could not be extracted from
the call stack.

\note
Here, "caller" means the first context in the call stack
that does not refer to one of Plop's methods/files.
Return information about the caller of this method .