public function registerCallback($commands, $callback, $params = array())
    {
        $commands = (array) $commands;
        $params = (array) AnConfig::unbox($params);

        foreach ($commands as $command) {
            $command = strtolower($command);

            if (! isset($this->_callbacks[$command])) {
                $this->_callbacks[$command] = array();
                $this->_params[$command] = array();
            }

            //Don't re-register commands.
            $index = array_search($callback, $this->_callbacks[$command], true);

            if ($index === false) {
                $this->_callbacks[$command][] = $callback;
                $this->_params[$command][] = $params;
            } else {
                $this->_params[$command][$index] = array_merge($this->_params[$command][$index], $params);
            }
        }

        return $this->_mixer;
    }
public function registerCallback($commands, $callback, $params = array())
    {
        $commands = (array) $commands;
        $params = (array) AnConfig::unbox($params);

        foreach ($commands as $command) {
            $command = strtolower($command);

            if (! isset($this->_callbacks[$command])) {
                $this->_callbacks[$command] = array();
                $this->_params[$command] = array();
            }

            //Don't re-register commands.
            $index = array_search($callback, $this->_callbacks[$command], true);

            if ($index === false) {
                $this->_callbacks[$command][] = $callback;
                $this->_params[$command][] = $params;
            } else {
                $this->_params[$command][$index] = array_merge($this->_params[$command][$index], $params);
            }
        }

        return $this->_mixer;
    }
public function registerCallback ( $ commands , $ callback , $ params = array ( ) ) { $ commands = ( array ) $ commands ; $ params = ( array ) AnConfig :: unbox ( $ params ) ; foreach ( $ commands as $ command ) { $ command = strtolower ( $ command ) ; if ( ! isset ( $ this -> _callbacks [ $ command ] ) ) { $ this -> _callbacks [ $ command ] = array ( ) ; $ this -> _params [ $ command ] = array ( ) ; } //Don't re-register commands. $ index = array_search ( $ callback , $ this -> _callbacks [ $ command ] , true ) ; if ( $ index === false ) { $ this -> _callbacks [ $ command ] [ ] = $ callback ; $ this -> _params [ $ command ] [ ] = $ params ; } else { $ this -> _params [ $ command ] [ $ index ] = array_merge ( $ this -> _params [ $ command ] [ $ index ] , $ params ) ; } } return $ this -> _mixer ; }
Registers a callback function

If the callback has already been registered. It will not be re-registered.

If params are passed as a associative array or as a AnConfig object they will be merged with the
context of the command chain and passed along. If they are passed as an indexed array they
will be passed to the callback directly.

@param  	string|array	The command name to register the callback for or an array of command names
@param 	callback		The callback function to register
@param   array|object    An associative array of config parameters or a AnConfig object
@return  AnObject	The mixer object
Registers a callback function