public function setAuthMethod($name, $callback, $prepend = true)
    {
        if (!is_string($name)) {
            return PEAR::raiseError('Method name is not a string');
        }

        if (!is_string($callback) && !is_array($callback)) {
            return PEAR::raiseError('Method callback must be string or array');
        }

        if (is_array($callback)) {
            if (!is_object($callback[0]) || !is_string($callback[1])) {
                return PEAR::raiseError('Bad mMethod callback array');
            }
        }

        if ($prepend) {
            $this->auth_methods = array_merge(
                array($name => $callback), $this->auth_methods
            );
        } else {
            $this->auth_methods[$name] = $callback;
        }

        return true;
    }
public function setAuthMethod($name, $callback, $prepend = true)
    {
        if (!is_string($name)) {
            return PEAR::raiseError('Method name is not a string');
        }

        if (!is_string($callback) && !is_array($callback)) {
            return PEAR::raiseError('Method callback must be string or array');
        }

        if (is_array($callback)) {
            if (!is_object($callback[0]) || !is_string($callback[1])) {
                return PEAR::raiseError('Bad mMethod callback array');
            }
        }

        if ($prepend) {
            $this->auth_methods = array_merge(
                array($name => $callback), $this->auth_methods
            );
        } else {
            $this->auth_methods[$name] = $callback;
        }

        return true;
    }
public function setAuthMethod ( $ name , $ callback , $ prepend = true ) { if ( ! is_string ( $ name ) ) { return PEAR :: raiseError ( 'Method name is not a string' ) ; } if ( ! is_string ( $ callback ) && ! is_array ( $ callback ) ) { return PEAR :: raiseError ( 'Method callback must be string or array' ) ; } if ( is_array ( $ callback ) ) { if ( ! is_object ( $ callback [ 0 ] ) || ! is_string ( $ callback [ 1 ] ) ) { return PEAR :: raiseError ( 'Bad mMethod callback array' ) ; } } if ( $ prepend ) { $ this -> auth_methods = array_merge ( array ( $ name => $ callback ) , $ this -> auth_methods ) ; } else { $ this -> auth_methods [ $ name ] = $ callback ; } return true ; }
Add a new authentication method.

@param string $name     The authentication method name (e.g. 'PLAIN')
@param mixed  $callback The authentication callback (given as the name of a
function or as an (object, method name) array).
@param bool   $prepend  Should the new method be prepended to the list of
available methods?  This is the default behavior,
giving the new method the highest priority.

@return mixed True on success or a PEAR_Error object on failure.

@since 1.6.0
Add a new authentication method .