public function registerCallback($path, $callback)
    {
        //Ensure the path is a string
        if (!is_string($path)) {
            throw new Exception('Path must be a string');
        }

        //Ensure that the callback is callable
        if (!is_callable($callback)) {
            throw new Exception('Callback must be callable');
        }

        //All tags and paths are lower cased, for consistency
        $path = strtolower($path);
        if (substr($path, -1, 1) !== '/') {
            $path .= '/';
        }

        //If this is the first callback for this path, initialise the variable
        if (!isset($this->callbacks[$path])) {
            $this->callback[$path] = array();
        }

        //Add the callback
        $this->callbacks[$path][] = $callback;

        return $this;
    }
public function registerCallback($path, $callback)
    {
        //Ensure the path is a string
        if (!is_string($path)) {
            throw new Exception('Path must be a string');
        }

        //Ensure that the callback is callable
        if (!is_callable($callback)) {
            throw new Exception('Callback must be callable');
        }

        //All tags and paths are lower cased, for consistency
        $path = strtolower($path);
        if (substr($path, -1, 1) !== '/') {
            $path .= '/';
        }

        //If this is the first callback for this path, initialise the variable
        if (!isset($this->callbacks[$path])) {
            $this->callback[$path] = array();
        }

        //Add the callback
        $this->callbacks[$path][] = $callback;

        return $this;
    }
public function registerCallback ( $ path , $ callback ) { //Ensure the path is a string if ( ! is_string ( $ path ) ) { throw new Exception ( 'Path must be a string' ) ; } //Ensure that the callback is callable if ( ! is_callable ( $ callback ) ) { throw new Exception ( 'Callback must be callable' ) ; } //All tags and paths are lower cased, for consistency $ path = strtolower ( $ path ) ; if ( substr ( $ path , - 1 , 1 ) !== '/' ) { $ path .= '/' ; } //If this is the first callback for this path, initialise the variable if ( ! isset ( $ this -> callbacks [ $ path ] ) ) { $ this -> callback [ $ path ] = array ( ) ; } //Add the callback $ this -> callbacks [ $ path ] [ ] = $ callback ; return $ this ; }
Registers a single callback for a specified XML path

@param string   $path     The path that the callback is for
@param callable $callback The callback mechanism to use

@return Parser
@throws Exception
Registers a single callback for a specified XML path