original_string: public function fault($fault = null, $code = 'Receiver') {
          $allowedfaultmodes = array(
              'VersionMismatch', 'MustUnderstand', 'DataEncodingUnknown',
              'Sender', 'Receiver', 'Server'
          );
          if (!in_array($code, $allowedfaultmodes)) {
              $code = 'Receiver';
          }
  
          // Intercept any exceptions and add the errorcode and debuginfo (optional).
          $actor = null;
          $details = null;
          $errorcode = 'unknownerror';
          $message = get_string($errorcode);
          if ($fault instanceof Exception) {
              // Add the debuginfo to the exception message if debuginfo must be returned.
              $actor = isset($fault->errorcode) ? $fault->errorcode : null;
              $errorcode = $actor;
              if (debugging()) {
                  $message = $fault->getMessage();
                  $details = isset($fault->debuginfo) ? $fault->debuginfo : null;
              }
          } else if (is_string($fault)) {
              $message = $fault;
          }
  
          $this->soapserver->fault($code, $message . ' | ERRORCODE: ' . $errorcode, $actor, $details);
      }
code: public function fault($fault = null, $code = 'Receiver') {
          $allowedfaultmodes = array(
              'VersionMismatch', 'MustUnderstand', 'DataEncodingUnknown',
              'Sender', 'Receiver', 'Server'
          );
          if (!in_array($code, $allowedfaultmodes)) {
              $code = 'Receiver';
          }
  
          // Intercept any exceptions and add the errorcode and debuginfo (optional).
          $actor = null;
          $details = null;
          $errorcode = 'unknownerror';
          $message = get_string($errorcode);
          if ($fault instanceof Exception) {
              // Add the debuginfo to the exception message if debuginfo must be returned.
              $actor = isset($fault->errorcode) ? $fault->errorcode : null;
              $errorcode = $actor;
              if (debugging()) {
                  $message = $fault->getMessage();
                  $details = isset($fault->debuginfo) ? $fault->debuginfo : null;
              }
          } else if (is_string($fault)) {
              $message = $fault;
          }
  
          $this->soapserver->fault($code, $message . ' | ERRORCODE: ' . $errorcode, $actor, $details);
      }
code_tokens: public function fault ( $ fault = null , $ code = 'Receiver' ) { $ allowedfaultmodes = array ( 'VersionMismatch' , 'MustUnderstand' , 'DataEncodingUnknown' , 'Sender' , 'Receiver' , 'Server' ) ; if ( ! in_array ( $ code , $ allowedfaultmodes ) ) { $ code = 'Receiver' ; } // Intercept any exceptions and add the errorcode and debuginfo (optional). $ actor = null ; $ details = null ; $ errorcode = 'unknownerror' ; $ message = get_string ( $ errorcode ) ; if ( $ fault instanceof Exception ) { // Add the debuginfo to the exception message if debuginfo must be returned. $ actor = isset ( $ fault -> errorcode ) ? $ fault -> errorcode : null ; $ errorcode = $ actor ; if ( debugging ( ) ) { $ message = $ fault -> getMessage ( ) ; $ details = isset ( $ fault -> debuginfo ) ? $ fault -> debuginfo : null ; } } else if ( is_string ( $ fault ) ) { $ message = $ fault ; } $ this -> soapserver -> fault ( $ code , $ message . ' | ERRORCODE: ' . $ errorcode , $ actor , $ details ) ; }
docstring: Generate a server fault.
  
  Note that the parameter order is the reverse of SoapFault's constructor parameters.
  
  Moodle note: basically we return the faultactor (errorcode) and faultdetails (debuginfo).
  
  If an exception is passed as the first argument, its message and code
  will be used to create the fault object.
  
  @link   http://www.w3.org/TR/soap12-part1/#faultcodes
  @param  string|Exception $fault
  @param  string $code SOAP Fault Codes
docstring_tokens: Generate a server fault .