import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -18,7 +18,7 @@
|
||||
* @subpackage Gapps
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ServiceException.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: ServiceException.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -33,11 +33,11 @@ require_once 'Zend/Exception.php';
|
||||
require_once 'Zend/Gdata/Gapps/Error.php';
|
||||
|
||||
/**
|
||||
* Gdata Gapps Exception class. This is thrown when an
|
||||
* AppsForYourDomainErrors message is received from the Google Apps
|
||||
* Gdata Gapps Exception class. This is thrown when an
|
||||
* AppsForYourDomainErrors message is received from the Google Apps
|
||||
* servers.
|
||||
*
|
||||
* Several different errors may be represented by this exception. For a list
|
||||
* Several different errors may be represented by this exception. For a list
|
||||
* of error codes available, see getErrorCode.
|
||||
*
|
||||
* @category Zend
|
||||
@ -48,20 +48,20 @@ require_once 'Zend/Gdata/Gapps/Error.php';
|
||||
*/
|
||||
class Zend_Gdata_Gapps_ServiceException extends Zend_Exception
|
||||
{
|
||||
|
||||
|
||||
protected $_rootElement = "AppsForYourDomainErrors";
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Array of Zend_Gdata_Error objects indexed by error code.
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_errors = array();
|
||||
|
||||
|
||||
/**
|
||||
* Create a new ServiceException.
|
||||
*
|
||||
* @return array An array containing a collection of
|
||||
* @return array An array containing a collection of
|
||||
* Zend_Gdata_Gapps_Error objects.
|
||||
*/
|
||||
public function __construct($errors = null) {
|
||||
@ -70,32 +70,32 @@ class Zend_Gdata_Gapps_ServiceException extends Zend_Exception
|
||||
$this->setErrors($errors);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a single Error object to the list of errors received by the
|
||||
* Add a single Error object to the list of errors received by the
|
||||
* server.
|
||||
*
|
||||
* @param Zend_Gdata_Gapps_Error $error An instance of an error returned
|
||||
*
|
||||
* @param Zend_Gdata_Gapps_Error $error An instance of an error returned
|
||||
* by the server. The error's errorCode must be set.
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
*/
|
||||
public function addError($error) {
|
||||
// Make sure that we don't try to index an error that doesn't
|
||||
// Make sure that we don't try to index an error that doesn't
|
||||
// contain an index value.
|
||||
if ($error->getErrorCode() == null) {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception("Error encountered without corresponding error code.");
|
||||
}
|
||||
|
||||
|
||||
$this->_errors[$error->getErrorCode()] = $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the list of errors as sent by the server inside of an
|
||||
* Set the list of errors as sent by the server inside of an
|
||||
* AppsForYourDomainErrors tag.
|
||||
*
|
||||
* @param array $array An associative array containing a collection of
|
||||
* Zend_Gdata_Gapps_Error objects. All errors must have their
|
||||
*
|
||||
* @param array $array An associative array containing a collection of
|
||||
* Zend_Gdata_Gapps_Error objects. All errors must have their
|
||||
* errorCode value set.
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
*/
|
||||
@ -105,22 +105,22 @@ class Zend_Gdata_Gapps_ServiceException extends Zend_Exception
|
||||
$this->addError($error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of errors as sent by the server inside of an
|
||||
* Get the list of errors as sent by the server inside of an
|
||||
* AppsForYourDomainErrors tag.
|
||||
*
|
||||
* @return array An associative array containing a collection of
|
||||
*
|
||||
* @return array An associative array containing a collection of
|
||||
* Zend_Gdata_Gapps_Error objects, indexed by error code.
|
||||
*/
|
||||
public function getErrors() {
|
||||
return $this->_errors;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the Error object associated with a specific error code.
|
||||
*
|
||||
* @return Zend_Gdata_Gapps_Error The Error object requested, or null
|
||||
* @return Zend_Gdata_Gapps_Error The Error object requested, or null
|
||||
* if not found.
|
||||
*/
|
||||
public function getError($errorCode) {
|
||||
@ -131,22 +131,22 @@ class Zend_Gdata_Gapps_ServiceException extends Zend_Exception
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check whether or not a particular error code was returned by the
|
||||
* Check whether or not a particular error code was returned by the
|
||||
* server.
|
||||
*
|
||||
* @param integer $errorCode The error code to check against.
|
||||
* @return boolean Whether or not the supplied error code was returned
|
||||
* @return boolean Whether or not the supplied error code was returned
|
||||
* by the server.
|
||||
*/
|
||||
public function hasError($errorCode) {
|
||||
return array_key_exists($errorCode, $this->_errors);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Import an AppsForYourDomain error from XML.
|
||||
*
|
||||
*
|
||||
* @param string $string The XML data to be imported
|
||||
* @return Zend_Gdata_Gapps_ServiceException Provides a fluent interface.
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
@ -155,21 +155,21 @@ class Zend_Gdata_Gapps_ServiceException extends Zend_Exception
|
||||
if ($string) {
|
||||
// Check to see if an AppsForYourDomainError exists
|
||||
//
|
||||
// track_errors is temporarily enabled so that if an error
|
||||
// occurs while parsing the XML we can append it to an
|
||||
// track_errors is temporarily enabled so that if an error
|
||||
// occurs while parsing the XML we can append it to an
|
||||
// exception by referencing $php_errormsg
|
||||
@ini_set('track_errors', 1);
|
||||
$doc = new DOMDocument();
|
||||
$success = @$doc->loadXML($string);
|
||||
@ini_restore('track_errors');
|
||||
|
||||
|
||||
if (!$success) {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
// $php_errormsg is automatically generated by PHP if
|
||||
// $php_errormsg is automatically generated by PHP if
|
||||
// an error occurs while calling loadXML(), above.
|
||||
throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $php_errormsg");
|
||||
}
|
||||
|
||||
|
||||
// Ensure that the outermost node is an AppsForYourDomain error.
|
||||
// If it isn't, something has gone horribly wrong.
|
||||
$rootElement = $doc->getElementsByTagName($this->_rootElement)->item(0);
|
||||
@ -177,7 +177,7 @@ class Zend_Gdata_Gapps_ServiceException extends Zend_Exception
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.');
|
||||
}
|
||||
|
||||
|
||||
foreach ($rootElement->childNodes as $errorNode) {
|
||||
if (!($errorNode instanceof DOMText)) {
|
||||
$error = new Zend_Gdata_Gapps_Error();
|
||||
@ -190,12 +190,12 @@ class Zend_Gdata_Gapps_ServiceException extends Zend_Exception
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception('XML passed to transferFromXML cannot be null');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a human readable version of this exception.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
|
Reference in New Issue
Block a user