public function fault($fault = null, $code = "Receiver")
    {
        if ($fault instanceof Exception) {
            $class = get_class($fault);
            if (in_array($class, $this->_faultExceptions)) {
                $message = $fault->getMessage();
                $eCode   = $fault->getCode();
                $code    = empty($eCode) ? $code : $eCode;
            } else {
                $message = 'Unknown error';
            }
        } elseif (is_string($fault)) {
            $message = $fault;
        } else {
            $message = 'Unknown error';
        }

        $allowedFaultModes = array(
            'VersionMismatch', 'MustUnderstand', 'DataEncodingUnknown',
            'Sender', 'Receiver', 'Server'
        );
        if (!in_array($code, $allowedFaultModes)) {
            $code = "Receiver";
        }

        return new SoapFault($code, $message);
    }
public function fault($fault = null, $code = "Receiver")
    {
        if ($fault instanceof Exception) {
            $class = get_class($fault);
            if (in_array($class, $this->_faultExceptions)) {
                $message = $fault->getMessage();
                $eCode   = $fault->getCode();
                $code    = empty($eCode) ? $code : $eCode;
            } else {
                $message = 'Unknown error';
            }
        } elseif (is_string($fault)) {
            $message = $fault;
        } else {
            $message = 'Unknown error';
        }

        $allowedFaultModes = array(
            'VersionMismatch', 'MustUnderstand', 'DataEncodingUnknown',
            'Sender', 'Receiver', 'Server'
        );
        if (!in_array($code, $allowedFaultModes)) {
            $code = "Receiver";
        }

        return new SoapFault($code, $message);
    }
public function fault ( $ fault = null , $ code = "Receiver" ) { if ( $ fault instanceof Exception ) { $ class = get_class ( $ fault ) ; if ( in_array ( $ class , $ this -> _faultExceptions ) ) { $ message = $ fault -> getMessage ( ) ; $ eCode = $ fault -> getCode ( ) ; $ code = empty ( $ eCode ) ? $ code : $ eCode ; } else { $ message = 'Unknown error' ; } } elseif ( is_string ( $ fault ) ) { $ message = $ fault ; } else { $ message = 'Unknown error' ; } $ allowedFaultModes = array ( 'VersionMismatch' , 'MustUnderstand' , 'DataEncodingUnknown' , 'Sender' , 'Receiver' , 'Server' ) ; if ( ! in_array ( $ code , $ allowedFaultModes ) ) { $ code = "Receiver" ; } return new SoapFault ( $ code , $ message ) ; }
Generate a server fault

Note that the arguments are reverse to those of SoapFault.

If an exception is passed as the first argument, its message and code
will be used to create the fault object if it has been registered via
{@Link registerFaultException()}.

@link   http://www.w3.org/TR/soap12-part1/#faultcodes
@param  string|Exception $fault
@param  string $code SOAP Fault Codes
@return SoapFault
Generate a server fault