|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00026 require_once 'Zend/Service/DeveloperGarden/Response/ResponseAbstract.php'; 00027 00036 abstract class Zend_Service_DeveloperGarden_Response_VoiceButler_VoiceButlerAbstract 00037 extends Zend_Service_DeveloperGarden_Response_ResponseAbstract 00038 { 00044 public $return = null; 00045 00051 public function getReturn() 00052 { 00053 return $this->return; 00054 } 00055 00062 public function parse() 00063 { 00064 if ($this->hasError()) { 00065 throw new Zend_Service_DeveloperGarden_Response_Exception( 00066 $this->getErrorMessage(), 00067 $this->getErrorCode() 00068 ); 00069 } 00070 00071 return $this; 00072 } 00073 00079 public function getErrorCode() 00080 { 00081 $retValue = null; 00082 if ($this->return instanceof stdClass) { 00083 $retValue = $this->return->status; 00084 } 00085 return $retValue; 00086 } 00087 00093 public function getErrorMessage() 00094 { 00095 $retValue = null; 00096 if ($this->return instanceof stdClass) { 00097 $retValue = $this->return->err_msg; 00098 } 00099 return $retValue; 00100 } 00101 00107 public function isValid() 00108 { 00109 return ($this->return === null 00110 || $this->return->status == '0000'); 00111 } 00112 00118 public function hasError() 00119 { 00120 $retValue = false; 00121 if ($this->return instanceof stdClass 00122 && $this->return->status != '0000' 00123 ) { 00124 $retValue = true; 00125 } 00126 return $retValue; 00127 } 00128 }