public function addFunction($function, $namespace = '')
    {
        // Bail early if set to SOAP_FUNCTIONS_ALL
        if ($this->_functions == SOAP_FUNCTIONS_ALL) {
            return $this;
        }

        if (is_array($function)) {
            foreach ($function as $func) {
                if (is_string($func) && function_exists($func)) {
                    $this->_functions[] = $func;
                } else {
                    require_once 'Zend/Soap/Server/Exception.php';
                    throw new Zend_Soap_Server_Exception('One or more invalid functions specified in array');
                }
            }
            $this->_functions = array_merge($this->_functions, $function);
        } elseif (is_string($function) && function_exists($function)) {
            $this->_functions[] = $function;
        } elseif ($function == SOAP_FUNCTIONS_ALL) {
            $this->_functions = SOAP_FUNCTIONS_ALL;
        } else {
            require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('Invalid function specified');
        }

        if (is_array($this->_functions)) {
            $this->_functions = array_unique($this->_functions);
        }

        return $this;
    }
public function addFunction($function, $namespace = '')
    {
        // Bail early if set to SOAP_FUNCTIONS_ALL
        if ($this->_functions == SOAP_FUNCTIONS_ALL) {
            return $this;
        }

        if (is_array($function)) {
            foreach ($function as $func) {
                if (is_string($func) && function_exists($func)) {
                    $this->_functions[] = $func;
                } else {
                    require_once 'Zend/Soap/Server/Exception.php';
                    throw new Zend_Soap_Server_Exception('One or more invalid functions specified in array');
                }
            }
            $this->_functions = array_merge($this->_functions, $function);
        } elseif (is_string($function) && function_exists($function)) {
            $this->_functions[] = $function;
        } elseif ($function == SOAP_FUNCTIONS_ALL) {
            $this->_functions = SOAP_FUNCTIONS_ALL;
        } else {
            require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('Invalid function specified');
        }

        if (is_array($this->_functions)) {
            $this->_functions = array_unique($this->_functions);
        }

        return $this;
    }
public function addFunction ( $ function , $ namespace = '' ) { // Bail early if set to SOAP_FUNCTIONS_ALL if ( $ this -> _functions == SOAP_FUNCTIONS_ALL ) { return $ this ; } if ( is_array ( $ function ) ) { foreach ( $ function as $ func ) { if ( is_string ( $ func ) && function_exists ( $ func ) ) { $ this -> _functions [ ] = $ func ; } else { require_once 'Zend/Soap/Server/Exception.php' ; throw new Zend_Soap_Server_Exception ( 'One or more invalid functions specified in array' ) ; } } $ this -> _functions = array_merge ( $ this -> _functions , $ function ) ; } elseif ( is_string ( $ function ) && function_exists ( $ function ) ) { $ this -> _functions [ ] = $ function ; } elseif ( $ function == SOAP_FUNCTIONS_ALL ) { $ this -> _functions = SOAP_FUNCTIONS_ALL ; } else { require_once 'Zend/Soap/Server/Exception.php' ; throw new Zend_Soap_Server_Exception ( 'Invalid function specified' ) ; } if ( is_array ( $ this -> _functions ) ) { $ this -> _functions = array_unique ( $ this -> _functions ) ; } return $ this ; }
Attach a function as a server method

@param array|string $function Function name, array of function names to attach,
or SOAP_FUNCTIONS_ALL to attach all functions
@param  string $namespace Ignored
@return Zend_Soap_Server
@throws Zend_Soap_Server_Exception on invalid functions
Attach a function as a server method