コード例 #1
0
 /**
  * Gets policy info (for an enterprise user)
  *
  * @return The Policy object. If the operation was successful, the object contains the status, if not, the object
  * 			contains the error code and message.
  */
 public function getPolicyInfo()
 {
     $urld = 'dpi/v1/policy';
     $parameters = array();
     $this->response = $this->restTransportInstance->sendRequest($urld, $parameters, self::HTTP_GET, $this->authToken);
     $responseBody = simplexml_load_string($this->response);
     $returnObject = new Policy();
     if ($responseBody === false) {
         $errorCode = 'N/A';
         $errorMessage = 'The server has encountered an error, please try again.';
         $errorObject = new ErrorStatus($errorCode, $errorMessage);
         $returnObject->setErrorStatus($errorObject);
     } else {
         $errorStatus = $responseBody->errorStatus;
         if (empty($errorStatus)) {
             $returnObject->setFileExpiration((string) $responseBody->fileExpiration);
             $returnObject->setFileExpirationOverwrite((string) $responseBody->fileExpirationOverwrite);
             $returnObject->setPasswordProtect((string) $responseBody->passwordProtect);
             $returnObject->setPasswordProtectOverwrite((string) $responseBody->passwordProtectOverwrite);
             $returnObject->setReturnReceipt((string) $responseBody->returnReceipt);
             $returnObject->setReturnReceiptOverwrite((string) $responseBody->returnReceiptOverwrite);
             $returnObject->setVri((string) $responseBody->vri);
             $returnObject->setVriOverwrite((string) $responseBody->vriOverwrite);
             $returnObject->setVriShare((string) $responseBody->vriShare);
             $returnObject->setVriOverwriteShare((string) $responseBody->vriOverwriteShare);
             $blackList = (string) $responseBody->blackListedDomains;
             $returnObject->setBlackListedDomains(explode(",", $blackList));
             $whiteList = (string) $responseBody->whiteListedDomains;
             $returnObject->setWhiteListedDomains(explode(",", $whiteList));
             $blackListShare = (string) $responseBody->blackListedDomainsShare;
             $returnObject->setBlackListedDomainsShare(explode(",", $blackListShare));
             $whiteListShare = (string) $responseBody->whiteListedDomainsShare;
             $returnObject->setWhiteListedDomainsShare(explode(",", $whiteListShare));
         } else {
             $errorCode = (string) $responseBody->errorStatus->code;
             $errorMessage = (string) $responseBody->errorStatus->message;
             $errorObject = new ErrorStatus($errorCode, $errorMessage);
             $returnObject->setErrorStatus($errorObject);
         }
     }
     return $returnObject;
 }