Skip to content

Commit

Permalink
Refactor code with phpactor
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyen Van Nguyen <[email protected]>
  • Loading branch information
nguyennv committed Sep 30, 2024
1 parent d3922a6 commit 88a3ba2
Show file tree
Hide file tree
Showing 2,274 changed files with 40,616 additions and 32,035 deletions.
398 changes: 231 additions & 167 deletions src/Account/AccountApi.php

Large diffs are not rendered by default.

99 changes: 66 additions & 33 deletions src/Account/AccountApiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

use Zimbra\Admin\Struct\DomainSelector;
use Zimbra\Account\Struct\{
AuthAttrs,
AuthPrefs,
AuthToken,
DistributionListAction,
EntrySearchFilterInfo,
Expand Down Expand Up @@ -52,7 +50,7 @@ interface AccountApiInterface extends ApiInterface
* If {verifyAccount}="1", <account> is required and the account in the auth token is compared to the named account.
* Mismatch results in auth failure.
* An external app that relies on ZCS for user identification can use this to test if the auth token provided by the user belongs to that user.
* If {verifyAccount}="0" (default), only the auth token is verified and any <account> element specified is ignored.
* If {verifyAccount}="0" (default), only the auth token is verified and any <account> element specified is ignored.
*
* @param AccountSelector $account
* @param string $password
Expand Down Expand Up @@ -104,7 +102,10 @@ function auth(
* @param string $password
* @return Message\AuthResponse
*/
function authByAccountName(string $name, string $password): ?Message\AuthResponse;
function authByAccountName(
string $name,
string $password
): ?Message\AuthResponse;

/**
* Authenticate by account id
Expand All @@ -113,7 +114,10 @@ function authByAccountName(string $name, string $password): ?Message\AuthRespons
* @param string $password
* @return Message\AuthResponse
*/
function authByAccountId(string $id, string $password): ?Message\AuthResponse;
function authByAccountId(
string $id,
string $password
): ?Message\AuthResponse;

/**
* Authenticate by auth token
Expand All @@ -130,7 +134,10 @@ function authByToken(string $authToken): ?Message\AuthResponse;
* @param string $preauthKey
* @return Message\AuthResponse
*/
function authByPreauth(string $name, string $preauthKey): ?Message\AuthResponse;
function authByPreauth(
string $name,
string $preauthKey
): ?Message\AuthResponse;

/**
* Perform an autocomplete for a name against the Global Address List
Expand Down Expand Up @@ -187,17 +194,19 @@ function checkRights(array $targets = []): ?Message\CheckRightsResponse;
function clientInfo(DomainSelector $domain): ?Message\ClientInfoResponse;

/**
* Create a Distribution List
* Create a Distribution List
* Notes:
* authed account must have the privilege to create dist lists in the domain
* authed account must have the privilege to create dist lists in the domain
*
* @param string $name
* @param bool $dynamic
* @param array $attrs
* @return Message\CreateDistributionListResponse
*/
function createDistributionList(
string $name, ?bool $dynamic = null, array $attrs = []
string $name,
?bool $dynamic = null,
array $attrs = []
): ?Message\CreateDistributionListResponse;

/**
Expand All @@ -208,19 +217,23 @@ function createDistributionList(
* @param Identity $identity
* @return Message\CreateIdentityResponse
*/
function createIdentity(Identity $identity): ?Message\CreateIdentityResponse;
function createIdentity(
Identity $identity
): ?Message\CreateIdentityResponse;

/**
* Create a signature.
* If an id is provided it will be honored as the id for the signature.
* If an id is provided it will be honored as the id for the signature.
* CreateSignature will set account default signature to the signature being created
* if there is currently no default signature for the account.
* There can be at most one text/plain signatue and one text/html signature.
* There can be at most one text/plain signatue and one text/html signature.
*
* @param Signature $signature
* @return Message\CreateSignatureResponse
*/
function createSignature(Signature $signature): ?Message\CreateSignatureResponse;
function createSignature(
Signature $signature
): ?Message\CreateSignatureResponse;

/**
* Delete an Identity
Expand All @@ -238,13 +251,15 @@ function deleteIdentity(NameId $identity): ?Message\DeleteIdentityResponse;
* @param NameId $signature
* @return Message\DeleteSignatureResponse
*/
function deleteSignature(NameId $signature): ?Message\DeleteSignatureResponse;
function deleteSignature(
NameId $signature
): ?Message\DeleteSignatureResponse;

/**
* Return all targets of the specified rights applicable to the requested account.
* Notes:
* 1. This call only discovers grants granted on the designated target type of the specified rights.
* It does not return grants granted on target types the rights can inherit from.
* It does not return grants granted on target types the rights can inherit from.
* 2. For sendAs, sendOnBehalfOf, sendAsDistList, sendOnBehalfOfDistList rights, name attribute
* is not returned on <target> elements.
* Instead, addresses in the target entry's zimbraPrefAllowAddressForDelegatedSender are returned
Expand All @@ -258,12 +273,14 @@ function deleteSignature(NameId $signature): ?Message\DeleteSignatureResponse;
* @param array $rights
* @return Message\DiscoverRightsResponse
*/
function discoverRights(array $rights = []): ?Message\DiscoverRightsResponse;
function discoverRights(
array $rights = []
): ?Message\DiscoverRightsResponse;

/**
* Perform an action on a Distribution List
* Notes:
* - Authorized account must be one of the list owners
* - Authorized account must be one of the list owners
* - For owners/rights, only grants on the group itself will be modified,
* grants on domain and globalgrant (from which the right can be inherited) will not be touched.
* Only admins can modify grants on domains and globalgrant, owners of groups
Expand All @@ -274,13 +291,14 @@ function discoverRights(array $rights = []): ?Message\DiscoverRightsResponse;
* @return Message\DistributionListActionResponse
*/
function distributionListAction(
DistributionListSelector $dl, DistributionListAction $action
DistributionListSelector $dl,
DistributionListAction $action
): ?Message\DistributionListActionResponse;

/**
* End the current session, removing it from all caches.
* Called when the browser app (or other session-using app) shuts down.
* Has no effect if called in a <nosession> context.
* Has no effect if called in a <nosession> context.
*
* @param bool $logoff
* @param bool $clearAllSoapSessions
Expand All @@ -296,7 +314,7 @@ function endSession(
): ?Message\EndSessionResponse;

/**
* Returns groups the user is either a member or an owner of.
* Returns groups the user is either a member or an owner of.
* Notes:
* - isOwner is returned only if ownerOf on the request is 1 (true).
* - isMember is returned only if memberOf on the request is not "none".
Expand All @@ -318,11 +336,13 @@ function getAccountDistributionLists(
* @param AccountSelector $account
* @return Message\GetAccountInfoResponse
*/
function getAccountInfo(AccountSelector $account): ?Message\GetAccountInfoResponse;
function getAccountInfo(
AccountSelector $account
): ?Message\GetAccountInfoResponse;

/**
* Returns all locales defined in the system. This is the same list returned by
* java.util.Locale.getAvailableLocales(), sorted by display name (name attribute).
* java.util.Locale.getAvailableLocales(), sorted by display name (name attribute).
*
* @return Message\GetAllLocalesResponse
*/
Expand Down Expand Up @@ -400,7 +420,8 @@ function getIdentities(): ?Message\GetIdentitiesResponse;
* @return Message\GetInfoResponse
*/
function getInfo(
?string $sections = null, ?string $rights = null
?string $sections = null,
?string $rights = null
): ?Message\GetInfoResponse;

/**
Expand Down Expand Up @@ -481,7 +502,9 @@ function grantRights(array $aces = []): ?Message\GrantRightsResponse;
* @param Identity $identity
* @return Message\ModifyIdentityResponse
*/
function modifyIdentity(Identity $identity): ?Message\ModifyIdentityResponse;
function modifyIdentity(
Identity $identity
): ?Message\ModifyIdentityResponse;

/**
* Modify Preferences
Expand All @@ -501,19 +524,23 @@ function modifyPrefs(array $prefs = []): ?Message\ModifyPrefsResponse;
* @param array $props
* @return Message\ModifyPropertiesResponse
*/
function modifyProperties(array $props = []): ?Message\ModifyPropertiesResponse;
function modifyProperties(
array $props = []
): ?Message\ModifyPropertiesResponse;

/**
* Create a signature.
* If an id is provided it will be honored as the id for the signature.
* If an id is provided it will be honored as the id for the signature.
* CreateSignature will set account default signature to the signature being created
* if there is currently no default signature for the account.
* There can be at most one text/plain signatue and one text/html signature.
* There can be at most one text/plain signatue and one text/html signature.
*
* @param Signature $signature
* @return Message\ModifySignatureResponse
*/
function modifySignature(Signature $signature): ?Message\ModifySignatureResponse;
function modifySignature(
Signature $signature
): ?Message\ModifySignatureResponse;

/**
* Modify the anti-spam WhiteList and BlackList addresses
Expand All @@ -523,7 +550,8 @@ function modifySignature(Signature $signature): ?Message\ModifySignatureResponse
* @return Message\ModifyWhiteBlackListResponse
*/
function modifyWhiteBlackList(
array $whiteListEntries = [], array $blackListEntries = []
array $whiteListEntries = [],
array $blackListEntries = []
): ?Message\ModifyWhiteBlackListResponse;

/**
Expand All @@ -532,7 +560,9 @@ function modifyWhiteBlackList(
* @param array $zimlets
* @return Message\ModifyZimletPrefsResponse
*/
function modifyZimletPrefs(array $zimlets = []): ?Message\ModifyZimletPrefsResponse;
function modifyZimletPrefs(
array $zimlets = []
): ?Message\ModifyZimletPrefsResponse;

/**
* Reset password
Expand All @@ -548,7 +578,9 @@ function resetPassword(string $password): ?Message\ResetPasswordResponse;
* @param string $accessToken
* @return Message\RevokeOAuthConsumerResponse
*/
function revokeOAuthConsumer(string $accessToken): ?Message\RevokeOAuthConsumerResponse;
function revokeOAuthConsumer(
string $accessToken
): ?Message\RevokeOAuthConsumerResponse;

/**
* Revoke account level rights
Expand Down Expand Up @@ -626,14 +658,15 @@ function searchGal(
): ?Message\SearchGalResponse;

/**
* Subscribe to or unsubscribe from a distribution list
* Subscribe to or unsubscribe from a distribution list
*
* @param DistributionListSelector $dl
* @param DistributionListSubscribeOp $op
* @return Message\SubscribeDistributionListResponse
*/
function subscribeDistributionList(
DistributionListSelector $dl, DistributionListSubscribeOp $op
DistributionListSelector $dl,
DistributionListSubscribeOp $op
): ?Message\SubscribeDistributionListResponse;

/**
Expand Down
30 changes: 17 additions & 13 deletions src/Account/Message/AuthBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
namespace Zimbra\Account\Message;

use JMS\Serializer\Annotation\{Accessor, SerializedName, Type, XmlElement};
use Zimbra\Common\Struct\{SoapBody, SoapRequestInterface, SoapResponseInterface};
use Zimbra\Common\Struct\{
SoapBody,
SoapRequestInterface,
SoapResponseInterface
};

/**
* AuthBody class
*
*
* @package Zimbra
* @subpackage Account
* @category Message
Expand All @@ -26,24 +30,24 @@ class AuthBody extends SoapBody
{
/**
* Soap request
*
*
* @var SoapRequestInterface
*/
#[Accessor(getter: 'getRequest', setter: 'setRequest')]
#[SerializedName('AuthRequest')]
#[Accessor(getter: "getRequest", setter: "setRequest")]
#[SerializedName("AuthRequest")]
#[Type(AuthRequest::class)]
#[XmlElement(namespace: 'urn:zimbraAccount')]
#[XmlElement(namespace: "urn:zimbraAccount")]
private ?SoapRequestInterface $request = null;

/**
* Soap response
*
*
* @var SoapResponseInterface
*/
#[Accessor(getter: 'getResponse', setter: 'setResponse')]
#[SerializedName('AuthResponse')]
#[Accessor(getter: "getResponse", setter: "setResponse")]
#[SerializedName("AuthResponse")]
#[Type(AuthResponse::class)]
#[XmlElement(namespace: 'urn:zimbraAccount')]
#[XmlElement(namespace: "urn:zimbraAccount")]
private ?SoapResponseInterface $response = null;

/**
Expand All @@ -54,9 +58,9 @@ class AuthBody extends SoapBody
* @return self
*/
public function __construct(
?AuthRequest $request = null, ?AuthResponse $response = null
)
{
?AuthRequest $request = null,
?AuthResponse $response = null
) {
parent::__construct($request, $response);
}

Expand Down
Loading

0 comments on commit 88a3ba2

Please sign in to comment.