[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Zend Framework 4 * 5 * LICENSE 6 * 7 * This source file is subject to the new BSD license that is bundled 8 * with this package in the file LICENSE.txt. 9 * It is also available through the world-wide-web at this URL: 10 * http://framework.zend.com/license/new-bsd 11 * If you did not receive a copy of the license and are unable to 12 * obtain it through the world-wide-web, please send an email 13 * to [email protected] so we can send you a copy immediately. 14 * 15 * @category Zend 16 * @package Zend_Service 17 * @subpackage DeveloperGarden 18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 19 * @license http://framework.zend.com/license/new-bsd New BSD License 20 * @version $Id$ 21 */ 22 23 /** 24 * @see Zend_Service_DeveloperGarden_Response_ResponseAbstract 25 */ 26 require_once 'Zend/Service/DeveloperGarden/Response/ResponseAbstract.php'; 27 28 /** 29 * @category Zend 30 * @package Zend_Service 31 * @subpackage DeveloperGarden 32 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 33 * @author Marco Kaiser 34 * @license http://framework.zend.com/license/new-bsd New BSD License 35 */ 36 abstract class Zend_Service_DeveloperGarden_Response_SendSms_SendSmsAbstract 37 extends Zend_Service_DeveloperGarden_Response_ResponseAbstract 38 { 39 /** 40 * the return from the sms request 41 * 42 * @var stdClass 43 */ 44 public $return = null; 45 46 /** 47 * parse the response data and throws exceptions 48 * 49 * @throws Zend_Service_DeveloperGarden_Response_Exception 50 * @return Zend_Service_DeveloperGarden_Response_ResponseAbstract 51 */ 52 public function parse() 53 { 54 if ($this->hasError()) { 55 require_once 'Zend/Service/DeveloperGarden/Response/Exception.php'; 56 throw new Zend_Service_DeveloperGarden_Response_Exception( 57 $this->getErrorMessage(), 58 $this->getErrorCode() 59 ); 60 } 61 62 return $this; 63 } 64 65 /** 66 * returns the error code 67 * 68 * @return string|null 69 */ 70 public function getErrorCode() 71 { 72 $retValue = null; 73 if ($this->return instanceof stdClass) { 74 $retValue = $this->return->status; 75 } 76 return $retValue; 77 } 78 79 /** 80 * returns the error message 81 * 82 * @return string 83 */ 84 public function getErrorMessage() 85 { 86 $retValue = null; 87 if ($this->return instanceof stdClass) { 88 $retValue = $this->return->description; 89 } 90 return $retValue; 91 } 92 93 /** 94 * returns true if the errorCode is not null and not 0000 95 * 96 * @return boolean 97 */ 98 public function isValid() 99 { 100 return ($this->return === null 101 || $this->return->status == '0000'); 102 } 103 104 /** 105 * returns true if we have a error situation 106 * 107 * @return boolean 108 */ 109 public function hasError() 110 { 111 $retValue = false; 112 if ($this->return instanceof stdClass 113 && $this->return->status != '0000' 114 ) { 115 $retValue = true; 116 } 117 return $retValue; 118 } 119 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |