CodeCaller

Since v1.2016041701

Description

CodeCaller is a value object. It represents a stack frame on a debug_backtrace() stack.

FilterCodeCaller will build a CodeCaller object for you.

Public Interface

CodeCaller has the following public interface:

namespace GanbaroDigital\ExceptionHelpers\V1\Callers\Values\CodeCaller;

use GanbaroDigital\MissingBits\TraceInspectors\StackFrame;

class CodeCaller extends StackFrame
{
    /**
     * constructor
     *
     * @param string|null $class
     *        which class called us?
     * @param string|null $function
     *        which function or method called us?
     * @param string|null $file
     *        which file was the calling code in?
     * @param int|null $line
     *        which line in $file was the calling code on?
     * @param array $stack
     *        what was the call stack at the time?
     * @inheritedFrom StackFrame
     */
    public function __construct($class, $function, $file, $line, $stack = []);

    /**
     * which class called us?
     *
     * @return string|null
     * @inheritedFrom StackFrame
     */
    public function getClass();

    /**
     * which function or method called us?
     *
     * @return string|null
     * @inheritedFrom StackFrame
     */
    public function getFunction();

    /**
     * which method called us?
     *
     * @return string|null
     * @inheritedFrom StackFrame
     */
    public function getMethod();

    /**
     * which file was the calling code defined in?
     *
     * @return string|null
     * @inheritedFrom StackFrame
     */
    public function getFilename();

    /**
     * which line in $this->getFile() was the calling code defined on?
     *
     * @return int|null
     * @inheritedFrom StackFrame
     */
    public function getLine();

    /**
     * what were the contents of the call stack at the time?
     *
     * an empty array means that we weren't asked to save the call stack
     * (probably to save memory - the call stack can be large)
     *
     * @return array
     * @inheritedFrom StackFrame
     */
    public function getStack();

    /**
     * return our contents as a sensible, printable string
     *
     * @return string
     */
    public function getCaller();

    /**
     * return our contents as a sensible, printable string
     *
     * @return string
     * @inheritedFrom StackFrame
     */
    public function __toString();
}

Notes

None at this time.

Changelog

v1.2016052501

See Also