/** * Get Share Info - get the share info of a folder * * @param folderId - required - * Id of the folder. * @return The Share object containing the share folder info or the error status of the operation. */ public function getShareInfo($folderId) { $urld = 'dpi/v1/folder/' . $folderId . '/share'; $parameters = array(); $this->response = $this->restTransportInstance->sendRequest($urld, $parameters, self::HTTP_GET, $this->authToken); $responseBody = simplexml_load_string($this->response); $returnObject = new Share(); 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)) { if ($responseBody->count() > 0) { $members = array(); foreach ($responseBody->children() as $child) { $member = new Member(); $member->setStatus((string) $child->status); $member->setCanInvite((string) $child->canInvite); $member->setCanRead((string) $child->canRead); $member->setCanWrite((string) $child->canWrite); $member->setEmail((string) $child->email); $member->setInvitationKey((string) $child->invitationKey); array_push($members, $member); } $returnObject->setMembers($members); } } else { $errorCode = (string) $responseBody->errorStatus->code; $errorMessage = (string) $responseBody->errorStatus->message; $errorObject = new ErrorStatus($errorCode, $errorMessage); $returnObject->setErrorStatus($errorObject); } } return $returnObject; }