Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyen Van Nguyen <[email protected]>
  • Loading branch information
nguyennv committed Aug 10, 2022
1 parent 90c8f9b commit 15f62ae
Show file tree
Hide file tree
Showing 48 changed files with 126 additions and 639 deletions.
3 changes: 0 additions & 3 deletions src/Common/Struct/ContactInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ function setDlist(string $dlist): self;
function setReference(string $reference): self;
function setTooManyMembers(bool $tooManyMembers): self;
function setMetadatas(array $metadatas): self;
function addMetadata(CustomMetadataInterface $metadata): self;
function setAttrs(array $attrs): self;
function addAttr(ContactAttr $attr): self;
function setContactGroupMembers(array $contactGroupMembers): self;
function addContactGroupMember(ContactGroupMemberInterface $contactGroupMember): self;

function getId(): string;
function getSortField(): ?string;
Expand Down
1 change: 0 additions & 1 deletion src/Common/Struct/MessageCommonInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ function setRevision(int $revision): self;
function setChangeDate(int $changeDate): self;
function setModifiedSequence(int $modifiedSequence): self;
function setMetadatas(array $metadatas): self;
function addMetadata(CustomMetadataInterface $metadata): self;

function getSize(): ?int;
function getDate(): ?int;
Expand Down
2 changes: 0 additions & 2 deletions src/Common/Struct/MessageInfoInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ function setSubject(string $subject): self;
function setMessageIdHeader(string $messageIdHeader): self;
function setInReplyTo(string $inReplyTo): self;
function setHeaders(array $headers): self;
function addHeader(KeyValuePair $header): self;

function getId(): ?string;
function getCalendarIntendedFor(): ?string;
Expand All @@ -57,7 +56,6 @@ function getInReplyTo(): ?string;
function getHeaders(): array;

function setEmailInterfaces(array $emails): self;
function addEmailInterface(EmailInfoInterface $email): self;
function setInviteInterface(InviteInfoInterface $invite): self;
function getEmailInterfaces(): array;
function getInvitInterface(): ?InviteInfoInterface;
Expand Down
30 changes: 8 additions & 22 deletions src/Mail/Message/CreateDataSourceResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,45 +130,31 @@ class CreateDataSourceResponse extends SoapResponse
* @return self
*/
public function __construct(?Id $dataSource = NULL)
{
if ($dataSource instanceof Id) {
$this->setDataSource($dataSource);
}
}

/**
* Set dataSource
*
* @param Id $dataSource
* @return self
*/
public function setDataSource(Id $dataSource): self
{
if ($dataSource instanceof ImapDataSourceId) {
return $this->setImapDataSource($dataSource);
$this->setImapDataSource($dataSource);
}
if ($dataSource instanceof Pop3DataSourceId) {
return $this->setPop3DataSource($dataSource);
$this->setPop3DataSource($dataSource);
}
if ($dataSource instanceof CaldavDataSourceId) {
return $this->setCaldavDataSource($dataSource);
$this->setCaldavDataSource($dataSource);
}
if ($dataSource instanceof YabDataSourceId) {
return $this->setYabDataSource($dataSource);
$this->setYabDataSource($dataSource);
}
if ($dataSource instanceof RssDataSourceId) {
return $this->setRssDataSource($dataSource);
$this->setRssDataSource($dataSource);
}
if ($dataSource instanceof GalDataSourceId) {
return $this->setGalDataSource($dataSource);
$this->setGalDataSource($dataSource);
}
if ($dataSource instanceof CalDataSourceId) {
return $this->setCalDataSource($dataSource);
$this->setCalDataSource($dataSource);
}
if ($dataSource instanceof UnknownDataSourceId) {
return $this->setUnknownDataSource($dataSource);
$this->setUnknownDataSource($dataSource);
}
return $this;
}

/**
Expand Down
28 changes: 8 additions & 20 deletions src/Mail/Message/GetDataSourcesResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,14 @@ class GetDataSourcesResponse extends SoapResponse
*/
public function __construct(array $dataSources = [])
{
$this->setDataSources($dataSources);
$this->setImapDataSources($dataSources)
->setPop3DataSources($dataSources)
->setCaldavDataSources($dataSources)
->setYabDataSources($dataSources)
->setRssDataSources($dataSources)
->setGalDataSources($dataSources)
->setCalDataSources($dataSources)
->setUnknownDataSources($dataSources);
}

/**
Expand Down Expand Up @@ -310,25 +317,6 @@ public function setUnknownDataSources(array $dataSources): self
return $this;
}

/**
* Set dataSources
*
* @param array $dataSources
* @return self
*/
public function setDataSources(array $dataSources): self
{
$this->setImapDataSources($dataSources)
->setPop3DataSources($dataSources)
->setCaldavDataSources($dataSources)
->setYabDataSources($dataSources)
->setRssDataSources($dataSources)
->setGalDataSources($dataSources)
->setCalDataSources($dataSources)
->setUnknownDataSources($dataSources);
return $this;
}

/**
* Get dataSources
*
Expand Down
2 changes: 1 addition & 1 deletion src/Mail/Message/GetRecurResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
CalTZInfo,
CancelItemRecur,
ExceptionItemRecur,
InviteItemRecur,
InviteItemRecur
};
use Zimbra\Common\Struct\SoapResponse;

Expand Down
56 changes: 1 addition & 55 deletions src/Mail/Struct/CalendarItemHitInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,25 +346,7 @@ public function getCategories()
*/
public function setCategories(array $categories)
{
$this->categories = [];
foreach ($categories as $category) {
$this->addCategory($category);
}
return $this;
}

/**
* add category
*
* @param string $category
* @return self
*/
public function addCategory(string $category)
{
$category = trim($category);
if (!in_array($category, $this->categories)) {
$this->categories[] = $category;
}
$this->categories = array_unique(array_map(static fn ($category) => trim($category), $categories));
return $this;
}

Expand Down Expand Up @@ -412,18 +394,6 @@ public function setFragment(string $fragment): self
return $this;
}

/**
* Add instance
*
* @param InstanceDataInfo $instance
* @return self
*/
public function addInstance(InstanceDataInfo $instance): self
{
$this->instances[] = $instance;
return $this;
}

/**
* Set instances
*
Expand Down Expand Up @@ -468,18 +438,6 @@ public function setAlarmData(AlarmDataInfo $alarmData): self
return $this;
}

/**
* Add invite
*
* @param Invitation $invite
* @return self
*/
public function addInvite(Invitation $invite): self
{
$this->invites[] = $invite;
return $this;
}

/**
* Set invites
*
Expand All @@ -502,18 +460,6 @@ public function getInvites(): array
return $this->invites;
}

/**
* Add reply
*
* @param CalReply $reply
* @return self
*/
public function addReply(CalReply $reply): self
{
$this->replies[] = $reply;
return $this;
}

/**
* Set replies
*
Expand Down
36 changes: 0 additions & 36 deletions src/Mail/Struct/CalendarItemInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,18 +574,6 @@ public function getInvites(): array
return $this->invites;
}

/**
* Add invite
*
* @param Invitation $invite
* @return self
*/
public function addInvite(Invitation $invite): self
{
$this->invites[] = $invite;
return $this;
}

/**
* Set calendarReplies
*
Expand All @@ -608,18 +596,6 @@ public function getCalendarReplies(): array
return $this->calendarReplies;
}

/**
* Add reply
*
* @param CalendarReply $reply
* @return self
*/
public function addCalendarReply(CalendarReply $reply): self
{
$this->calendarReplies[] = $reply;
return $this;
}

/**
* Set metadatas
*
Expand All @@ -641,16 +617,4 @@ public function getMetadatas(): array
{
return $this->metadatas;
}

/**
* Add meta
*
* @param MailCustomMetadata $meta
* @return self
*/
public function addMetadata(MailCustomMetadata $meta): self
{
$this->metadatas[] = $meta;
return $this;
}
}
2 changes: 1 addition & 1 deletion src/Mail/Struct/CalendarItemRecur.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Zimbra\Mail\Struct;

use JMS\Serializer\Annotation\{Accessor, SerializedName, Type, XmlElement, XmlList};
use JMS\Serializer\Annotation\{Accessor, SerializedName, Type, XmlElement};
use Zimbra\Common\Struct\{
DtTimeInfoInterface,
DurationInfoInterface,
Expand Down
2 changes: 0 additions & 2 deletions src/Mail/Struct/CalendaringDataInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ interface CalendaringDataInterface extends CommonInstanceDataAttrsInterface
// function setDate(int $date);
function setOrganizer(CalOrganizer $organizer);
function setCategories(array $categories);
function addCategory(string $category);
function setGeo(GeoInfo $geo);
function setFragment(string $fragment);
// used in interface instead of methods related to JAXB field
function setInstances(array $instances);
// used in interface instead of methods related to JAXB field
function addInstance(InstanceDataInterface $instance);
function setAlarmData(AlarmDataInfo $alarmData);

// function getDate(): ?int;
Expand Down
12 changes: 0 additions & 12 deletions src/Mail/Struct/CommentInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,16 +436,4 @@ public function getMetadatas(): array
{
return $this->metadatas;
}

/**
* Add metadata
*
* @param MailCustomMetadata $metadata
* @return self
*/
public function addMetadata(MailCustomMetadata $metadata): self
{
$this->metadatas[] = $metadata;
return $this;
}
}
8 changes: 7 additions & 1 deletion src/Mail/Struct/CommonCalendaringData.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
namespace Zimbra\Mail\Struct;

use JMS\Serializer\Annotation\{Accessor, SerializedName, Type, XmlAttribute};
use Zimbra\Common\Enum\{FreeBusyStatus, InviteClass, InviteStatus, ParticipationStatus, Transparency};
use Zimbra\Common\Enum\{
FreeBusyStatus,
InviteClass,
InviteStatus,
ParticipationStatus,
Transparency
};

/**
* CommonCalendaringData struct class
Expand Down
12 changes: 0 additions & 12 deletions src/Mail/Struct/CommonDocumentInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -877,18 +877,6 @@ public function setMetadatas(array $metadatas): self
return $this;
}

/**
* Add metadata
*
* @param MailCustomMetadata $metadata
* @return self
*/
public function addMetadata(MailCustomMetadata $metadata): self
{
$this->metadatas[] = $metadata;
return $this;
}

/**
* Get fragment
*
Expand Down
8 changes: 7 additions & 1 deletion src/Mail/Struct/CommonInstanceDataAttrs.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
namespace Zimbra\Mail\Struct;

use JMS\Serializer\Annotation\{Accessor, SerializedName, Type, XmlAttribute};
use Zimbra\Common\Enum\{FreeBusyStatus, InviteClass, InviteStatus, ParticipationStatus, Transparency};
use Zimbra\Common\Enum\{
FreeBusyStatus,
InviteClass,
InviteStatus,
ParticipationStatus,
Transparency
};

/**
* CommonInstanceDataAttrs struct class
Expand Down
12 changes: 0 additions & 12 deletions src/Mail/Struct/ConflictRecurrenceInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,4 @@ public function getFreebusyUsers(): array
{
return $this->freebusyUsers;
}

/**
* Add freebusyUser
*
* @param FreeBusyUserStatus $freebusyUser
* @return self
*/
public function addFreebusyUser(FreeBusyUserStatus $freebusyUser): self
{
$this->freebusyUsers[] = $freebusyUser;
return $this;
}
}
Loading

0 comments on commit 15f62ae

Please sign in to comment.