-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split classes in their own file (#124)
Some classes were stored in the same file, not following PSR4 conventions. This prevented tools such as PHPStan to easily discover these symbols & read these classes. Moving them to different files does not cause a breaking change as the namespace does not change.
- Loading branch information
1 parent
b0c59b6
commit ecacd3c
Showing
5 changed files
with
260 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Postmark\Models; | ||
|
||
class PostmarkMessageDump | ||
{ | ||
public string $Body; | ||
|
||
public function __construct(string $body = '') | ||
{ | ||
$this->Body = $body; | ||
} | ||
|
||
public function getBody(): string | ||
{ | ||
return $this->Body; | ||
} | ||
|
||
public function setBody(string $Body): PostmarkMessageDump | ||
{ | ||
$this->Body = $Body; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
namespace Postmark\Models; | ||
|
||
class PostmarkMessageEvent | ||
{ | ||
public string $Recipient; | ||
public string $Type; | ||
public string $ReceivedAt; | ||
public PostmarkMessageEventDetails $Details; | ||
|
||
public function __construct(array $values = []) | ||
{ | ||
$this->Recipient = !empty($values['Recipient']) ? $values['Recipient'] : ''; | ||
$this->Type = !empty($values['Type']) ? $values['Type'] : ''; | ||
$this->ReceivedAt = !empty($values['ReceivedAt']) ? $values['ReceivedAt'] : ''; | ||
|
||
$arrayType = !empty($values['Details']) ? (array)$values['Details'] : []; | ||
$this->Details = !empty($values['Details']) ? new PostmarkMessageEventDetails( | ||
$arrayType | ||
) : new PostmarkMessageEventDetails(); | ||
} | ||
|
||
public function getRecipient(): string | ||
{ | ||
return $this->Recipient; | ||
} | ||
|
||
public function setRecipient(string $Recipient): PostmarkMessageEvent | ||
{ | ||
$this->Recipient = $Recipient; | ||
|
||
return $this; | ||
} | ||
|
||
public function getType(): string | ||
{ | ||
return $this->Type; | ||
} | ||
|
||
public function setType(string $Type): PostmarkMessageEvent | ||
{ | ||
$this->Type = $Type; | ||
|
||
return $this; | ||
} | ||
|
||
public function getReceivedAt(): string | ||
{ | ||
return $this->ReceivedAt; | ||
} | ||
|
||
public function setReceivedAt(string $ReceivedAt): PostmarkMessageEvent | ||
{ | ||
$this->ReceivedAt = $ReceivedAt; | ||
|
||
return $this; | ||
} | ||
|
||
public function getDetails(): PostmarkMessageEventDetails | ||
{ | ||
return $this->Details; | ||
} | ||
|
||
public function setDetails(PostmarkMessageEventDetails $Details): PostmarkMessageEvent | ||
{ | ||
$this->Details = $Details; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<?php | ||
|
||
namespace Postmark\Models; | ||
|
||
class PostmarkMessageEventDetails | ||
{ | ||
public ?string $DeliveryMessage; | ||
public ?string $DestinationServer; | ||
public ?string $DestinationIP; | ||
public ?string $Summary; | ||
public ?string $BounceID; | ||
public ?string $Origin; | ||
public ?string $SuppressSending; | ||
public ?string $Link; | ||
public ?string $ClickLocation; | ||
|
||
public function __construct(array $values = []) | ||
{ | ||
$this->DeliveryMessage = !empty($values['DeliveryMessage']) ? $values['DeliveryMessage'] : ''; | ||
$this->DestinationServer = !empty($values['DestinationServer']) ? $values['DestinationServer'] : ''; | ||
$this->DestinationIP = !empty($values['DestinationIP']) ? $values['DestinationIP'] : ''; | ||
|
||
$this->Summary = !empty($values['Summary']) ? $values['Summary'] : ''; | ||
$this->BounceID = !empty($values['BounceID']) ? $values['BounceID'] : ''; | ||
$this->Origin = !empty($values['Origin']) ? $values['Origin'] : ''; | ||
$this->SuppressSending = !empty($values['SuppressSending']) ? $values['SuppressSending'] : ''; | ||
$this->Link = !empty($values['Link']) ? $values['Link'] : ''; | ||
$this->ClickLocation = !empty($values['ClickLocation']) ? $values['ClickLocation'] : ''; | ||
} | ||
|
||
public function getDeliveryMessage(): ?string | ||
{ | ||
return $this->DeliveryMessage; | ||
} | ||
|
||
public function setDeliveryMessage(?string $DeliveryMessage): PostmarkMessageEventDetails | ||
{ | ||
$this->DeliveryMessage = $DeliveryMessage; | ||
|
||
return $this; | ||
} | ||
|
||
public function getDestinationServer(): ?string | ||
{ | ||
return $this->DestinationServer; | ||
} | ||
|
||
public function setDestinationServer(?string $DestinationServer): PostmarkMessageEventDetails | ||
{ | ||
$this->DestinationServer = $DestinationServer; | ||
|
||
return $this; | ||
} | ||
|
||
public function getDestinationIP(): ?string | ||
{ | ||
return $this->DestinationIP; | ||
} | ||
|
||
public function setDestinationIP(?string $DestinationIP): PostmarkMessageEventDetails | ||
{ | ||
$this->DestinationIP = $DestinationIP; | ||
|
||
return $this; | ||
} | ||
|
||
public function getSummary(): ?string | ||
{ | ||
return $this->Summary; | ||
} | ||
|
||
public function setSummary(?string $Summary): PostmarkMessageEventDetails | ||
{ | ||
$this->Summary = $Summary; | ||
return $this; | ||
} | ||
|
||
public function getBounceID(): ?string | ||
{ | ||
return $this->BounceID; | ||
} | ||
|
||
public function setBounceID(?string $BounceID): PostmarkMessageEventDetails | ||
{ | ||
$this->BounceID = $BounceID; | ||
return $this; | ||
} | ||
|
||
public function getOrigin(): ?string | ||
{ | ||
return $this->Origin; | ||
} | ||
|
||
public function setOrigin(?string $Origin): PostmarkMessageEventDetails | ||
{ | ||
$this->Origin = $Origin; | ||
return $this; | ||
} | ||
|
||
public function getSuppressSending(): ?string | ||
{ | ||
return $this->SuppressSending; | ||
} | ||
|
||
public function setSuppressSending(?string $SuppressSending): PostmarkMessageEventDetails | ||
{ | ||
$this->SuppressSending = $SuppressSending; | ||
return $this; | ||
} | ||
|
||
public function getLink(): ?string | ||
{ | ||
return $this->Link; | ||
} | ||
|
||
public function setLink(?string $Link): PostmarkMessageEventDetails | ||
{ | ||
$this->Link = $Link; | ||
return $this; | ||
} | ||
|
||
public function getClickLocation(): ?string | ||
{ | ||
return $this->ClickLocation; | ||
} | ||
|
||
public function setClickLocation(?string $ClickLocation): PostmarkMessageEventDetails | ||
{ | ||
$this->ClickLocation = $ClickLocation; | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Postmark\Models; | ||
|
||
class PostmarkMessageEvents | ||
{ | ||
public array $MessageEvents; | ||
|
||
public function __construct(array $values = []) | ||
{ | ||
$tempMessageEvents = []; | ||
foreach ($values['MessageEvents'] as $messageEvent) { | ||
$obj = json_decode(json_encode($messageEvent)); | ||
$postmarkMessage = new PostmarkMessageEvent((array)$obj); | ||
|
||
$tempMessageEvents[] = $postmarkMessage; | ||
} | ||
$this->MessageEvents = $tempMessageEvents; | ||
} | ||
|
||
public function getMessageEvents(): array | ||
{ | ||
return $this->MessageEvents; | ||
} | ||
|
||
public function setMessageEvents(array $MessageEvents): PostmarkMessageEvents | ||
{ | ||
$this->MessageEvents = $MessageEvents; | ||
|
||
return $this; | ||
} | ||
} |
Oops, something went wrong.