|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00028 require_once 'Zend/Gdata/App/Base.php'; 00029 00045 class Zend_Gdata_Gapps_Error extends Zend_Gdata_App_Base 00046 { 00047 00048 // Error codes as defined at 00049 // http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_reference.html#appendix_d 00050 00051 const UNKNOWN_ERROR = 1000; 00052 const USER_DELETED_RECENTLY = 1100; 00053 const USER_SUSPENDED = 1101; 00054 const DOMAIN_USER_LIMIT_EXCEEDED = 1200; 00055 const DOMAIN_ALIAS_LIMIT_EXCEEDED = 1201; 00056 const DOMAIN_SUSPENDED = 1202; 00057 const DOMAIN_FEATURE_UNAVAILABLE = 1203; 00058 const ENTITY_EXISTS = 1300; 00059 const ENTITY_DOES_NOT_EXIST = 1301; 00060 const ENTITY_NAME_IS_RESERVED = 1302; 00061 const ENTITY_NAME_NOT_VALID = 1303; 00062 const INVALID_GIVEN_NAME = 1400; 00063 const INVALID_FAMILY_NAME = 1401; 00064 const INVALID_PASSWORD = 1402; 00065 const INVALID_USERNAME = 1403; 00066 const INVALID_HASH_FUNCTION_NAME = 1404; 00067 const INVALID_HASH_DIGEST_LENGTH = 1405; 00068 const INVALID_EMAIL_ADDRESS = 1406; 00069 const INVALID_QUERY_PARAMETER_VALUE = 1407; 00070 const TOO_MANY_RECIPIENTS_ON_EMAIL_LIST = 1500; 00071 00072 protected $_errorCode = null; 00073 protected $_reason = null; 00074 protected $_invalidInput = null; 00075 00076 public function __construct($errorCode = null, $reason = null, 00077 $invalidInput = null) { 00078 parent::__construct("Google Apps error received: $errorCode ($reason)"); 00079 $this->_errorCode = $errorCode; 00080 $this->_reason = $reason; 00081 $this->_invalidInput = $invalidInput; 00082 } 00083 00091 public function setErrorCode($value) { 00092 $this->_errorCode = $value; 00093 } 00094 00131 public function getErrorCode() { 00132 return $this->_errorCode; 00133 } 00134 00141 public function setReason($value) { 00142 $this->_reason = $value; 00143 } 00144 00151 public function getReason() { 00152 return $this->_reason; 00153 } 00154 00161 public function setInvalidInput($value) { 00162 $this->_invalidInput = $value; 00163 } 00164 00171 public function getInvalidInput() { 00172 return $this->_invalidInput; 00173 } 00174 00184 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00185 { 00186 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00187 if ($this->_errorCode !== null) { 00188 $element->setAttribute('errorCode', $this->_errorCode); 00189 } 00190 if ($this->_reason !== null) { 00191 $element->setAttribute('reason', $this->_reason); 00192 } 00193 if ($this->_invalidInput !== null) { 00194 $element->setAttribute('invalidInput', $this->_invalidInput); 00195 } 00196 return $element; 00197 } 00198 00206 protected function takeAttributeFromDOM($attribute) 00207 { 00208 switch ($attribute->localName) { 00209 case 'errorCode': 00210 $this->_errorCode = $attribute->nodeValue; 00211 break; 00212 case 'reason': 00213 $this->_reason = $attribute->nodeValue; 00214 break; 00215 case 'invalidInput': 00216 $this->_invalidInput = $attribute->nodeValue; 00217 break; 00218 default: 00219 parent::takeAttributeFromDOM($attribute); 00220 } 00221 } 00222 00228 public function __toString() { 00229 return "Error " . $this->getErrorCode() . ": " . $this->getReason() . 00230 "\n\tInvalid Input: \"" . $this->getInvalidInput() . "\""; 00231 } 00232 00233 }