diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Service/DeveloperGarden/Response/SendSms/SendSmsAbstract.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Service/DeveloperGarden/Response/SendSms/SendSmsAbstract.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,119 @@ +hasError()) { + require_once 'Zend/Service/DeveloperGarden/Response/Exception.php'; + throw new Zend_Service_DeveloperGarden_Response_Exception( + $this->getErrorMessage(), + $this->getErrorCode() + ); + } + + return $this; + } + + /** + * returns the error code + * + * @return string|null + */ + public function getErrorCode() + { + $retValue = null; + if ($this->return instanceof stdClass) { + $retValue = $this->return->status; + } + return $retValue; + } + + /** + * returns the error message + * + * @return string + */ + public function getErrorMessage() + { + $retValue = null; + if ($this->return instanceof stdClass) { + $retValue = $this->return->description; + } + return $retValue; + } + + /** + * returns true if the errorCode is not null and not 0000 + * + * @return boolean + */ + public function isValid() + { + return ($this->return === null + || $this->return->status == '0000'); + } + + /** + * returns true if we have a error situation + * + * @return boolean + */ + public function hasError() + { + $retValue = false; + if ($this->return instanceof stdClass + && $this->return->status != '0000' + ) { + $retValue = true; + } + return $retValue; + } +}