Skip to content

Commit

Permalink
MDL-32949 ws: minor comments cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed May 15, 2012
1 parent 4617939 commit 5b0800d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
12 changes: 7 additions & 5 deletions webservice/soap/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ class moodle_zend_soap_server extends Zend_Soap_Server {
public function fault($fault = null, $code = "Receiver")
{

//run the zend code that clean/create a soapfault
// Run the zend code that clean/create a soapfault.
$soapfault = parent::fault($fault, $code);

//intercept any exceptions and add the errorcode and debuginfo (optional)
// Intercept any exceptions and add the errorcode and debuginfo (optional).
$actor = null;
$details = null;
if ($fault instanceof Exception) {
//add the debuginfo to the exception message if debuginfo must be returned
// Add the debuginfo to the exception message if debuginfo must be returned.
$actor = $fault->errorcode;
if (debugging() and isset($fault->debuginfo)) {
$details = $fault->debuginfo;
Expand All @@ -75,10 +75,12 @@ public function fault($fault = null, $code = "Receiver")
}

/**
* Handle a request
*
* NOTE: this is basically a copy of the Zend handle()
* but with $soap->fault returning faultactor + faultdetail
*
* Handle a request
* So we don't require coding style checks within this method
* to keep it as similar as the original one.
*
* Instantiates SoapServer object with options set in object, and
* dispatches its handle() method.
Expand Down
10 changes: 5 additions & 5 deletions webservice/xmlrpc/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ class moodle_zend_xmlrpc_server extends Zend_XmlRpc_Server {
*/
public function fault($fault = null, $code = 404)
{
//intercept any exceptions with debug info and transform it in Moodle exception
// Intercept any exceptions with debug info and transform it in Moodle exception.
if ($fault instanceof Exception) {
// code php exception must be a long
// we obtain a hash of the errorcode, and then to get an integer hash
// Code php exception must be a long
// we obtain a hash of the errorcode, and then to get an integer hash.
$code = base_convert(md5($fault->errorcode), 16, 10);
// code php exception being a long, it has a maximum number of digits.
// Code php exception being a long, it has a maximum number of digits.
// we strip the $code to 8 digits, and hope for no error code collisions.
// Collisions should be pretty rare, and if needed the client can retrieve
// the accurate errorcode from the last | in the exception message.
$code = substr($code, 0, 8);
//add the debuginfo to the exception message if debuginfo must be returned
// Add the debuginfo to the exception message if debuginfo must be returned.
if (debugging() and isset($fault->debuginfo)) {
$fault = new Exception($fault->getMessage() . ' | DEBUG INFO: ' . $fault->debuginfo
. ' | ERRORCODE: ' . $fault->errorcode, $code);
Expand Down

0 comments on commit 5b0800d

Please sign in to comment.