Skip to content

Commit ecacd3c

Browse files
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.
1 parent b0c59b6 commit ecacd3c

5 files changed

Lines changed: 260 additions & 246 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Postmark\Models;
4+
5+
class PostmarkMessageDump
6+
{
7+
public string $Body;
8+
9+
public function __construct(string $body = '')
10+
{
11+
$this->Body = $body;
12+
}
13+
14+
public function getBody(): string
15+
{
16+
return $this->Body;
17+
}
18+
19+
public function setBody(string $Body): PostmarkMessageDump
20+
{
21+
$this->Body = $Body;
22+
23+
return $this;
24+
}
25+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
3+
namespace Postmark\Models;
4+
5+
class PostmarkMessageEvent
6+
{
7+
public string $Recipient;
8+
public string $Type;
9+
public string $ReceivedAt;
10+
public PostmarkMessageEventDetails $Details;
11+
12+
public function __construct(array $values = [])
13+
{
14+
$this->Recipient = !empty($values['Recipient']) ? $values['Recipient'] : '';
15+
$this->Type = !empty($values['Type']) ? $values['Type'] : '';
16+
$this->ReceivedAt = !empty($values['ReceivedAt']) ? $values['ReceivedAt'] : '';
17+
18+
$arrayType = !empty($values['Details']) ? (array)$values['Details'] : [];
19+
$this->Details = !empty($values['Details']) ? new PostmarkMessageEventDetails(
20+
$arrayType
21+
) : new PostmarkMessageEventDetails();
22+
}
23+
24+
public function getRecipient(): string
25+
{
26+
return $this->Recipient;
27+
}
28+
29+
public function setRecipient(string $Recipient): PostmarkMessageEvent
30+
{
31+
$this->Recipient = $Recipient;
32+
33+
return $this;
34+
}
35+
36+
public function getType(): string
37+
{
38+
return $this->Type;
39+
}
40+
41+
public function setType(string $Type): PostmarkMessageEvent
42+
{
43+
$this->Type = $Type;
44+
45+
return $this;
46+
}
47+
48+
public function getReceivedAt(): string
49+
{
50+
return $this->ReceivedAt;
51+
}
52+
53+
public function setReceivedAt(string $ReceivedAt): PostmarkMessageEvent
54+
{
55+
$this->ReceivedAt = $ReceivedAt;
56+
57+
return $this;
58+
}
59+
60+
public function getDetails(): PostmarkMessageEventDetails
61+
{
62+
return $this->Details;
63+
}
64+
65+
public function setDetails(PostmarkMessageEventDetails $Details): PostmarkMessageEvent
66+
{
67+
$this->Details = $Details;
68+
69+
return $this;
70+
}
71+
}
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?php
2+
3+
namespace Postmark\Models;
4+
5+
class PostmarkMessageEventDetails
6+
{
7+
public ?string $DeliveryMessage;
8+
public ?string $DestinationServer;
9+
public ?string $DestinationIP;
10+
public ?string $Summary;
11+
public ?string $BounceID;
12+
public ?string $Origin;
13+
public ?string $SuppressSending;
14+
public ?string $Link;
15+
public ?string $ClickLocation;
16+
17+
public function __construct(array $values = [])
18+
{
19+
$this->DeliveryMessage = !empty($values['DeliveryMessage']) ? $values['DeliveryMessage'] : '';
20+
$this->DestinationServer = !empty($values['DestinationServer']) ? $values['DestinationServer'] : '';
21+
$this->DestinationIP = !empty($values['DestinationIP']) ? $values['DestinationIP'] : '';
22+
23+
$this->Summary = !empty($values['Summary']) ? $values['Summary'] : '';
24+
$this->BounceID = !empty($values['BounceID']) ? $values['BounceID'] : '';
25+
$this->Origin = !empty($values['Origin']) ? $values['Origin'] : '';
26+
$this->SuppressSending = !empty($values['SuppressSending']) ? $values['SuppressSending'] : '';
27+
$this->Link = !empty($values['Link']) ? $values['Link'] : '';
28+
$this->ClickLocation = !empty($values['ClickLocation']) ? $values['ClickLocation'] : '';
29+
}
30+
31+
public function getDeliveryMessage(): ?string
32+
{
33+
return $this->DeliveryMessage;
34+
}
35+
36+
public function setDeliveryMessage(?string $DeliveryMessage): PostmarkMessageEventDetails
37+
{
38+
$this->DeliveryMessage = $DeliveryMessage;
39+
40+
return $this;
41+
}
42+
43+
public function getDestinationServer(): ?string
44+
{
45+
return $this->DestinationServer;
46+
}
47+
48+
public function setDestinationServer(?string $DestinationServer): PostmarkMessageEventDetails
49+
{
50+
$this->DestinationServer = $DestinationServer;
51+
52+
return $this;
53+
}
54+
55+
public function getDestinationIP(): ?string
56+
{
57+
return $this->DestinationIP;
58+
}
59+
60+
public function setDestinationIP(?string $DestinationIP): PostmarkMessageEventDetails
61+
{
62+
$this->DestinationIP = $DestinationIP;
63+
64+
return $this;
65+
}
66+
67+
public function getSummary(): ?string
68+
{
69+
return $this->Summary;
70+
}
71+
72+
public function setSummary(?string $Summary): PostmarkMessageEventDetails
73+
{
74+
$this->Summary = $Summary;
75+
return $this;
76+
}
77+
78+
public function getBounceID(): ?string
79+
{
80+
return $this->BounceID;
81+
}
82+
83+
public function setBounceID(?string $BounceID): PostmarkMessageEventDetails
84+
{
85+
$this->BounceID = $BounceID;
86+
return $this;
87+
}
88+
89+
public function getOrigin(): ?string
90+
{
91+
return $this->Origin;
92+
}
93+
94+
public function setOrigin(?string $Origin): PostmarkMessageEventDetails
95+
{
96+
$this->Origin = $Origin;
97+
return $this;
98+
}
99+
100+
public function getSuppressSending(): ?string
101+
{
102+
return $this->SuppressSending;
103+
}
104+
105+
public function setSuppressSending(?string $SuppressSending): PostmarkMessageEventDetails
106+
{
107+
$this->SuppressSending = $SuppressSending;
108+
return $this;
109+
}
110+
111+
public function getLink(): ?string
112+
{
113+
return $this->Link;
114+
}
115+
116+
public function setLink(?string $Link): PostmarkMessageEventDetails
117+
{
118+
$this->Link = $Link;
119+
return $this;
120+
}
121+
122+
public function getClickLocation(): ?string
123+
{
124+
return $this->ClickLocation;
125+
}
126+
127+
public function setClickLocation(?string $ClickLocation): PostmarkMessageEventDetails
128+
{
129+
$this->ClickLocation = $ClickLocation;
130+
return $this;
131+
}
132+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Postmark\Models;
4+
5+
class PostmarkMessageEvents
6+
{
7+
public array $MessageEvents;
8+
9+
public function __construct(array $values = [])
10+
{
11+
$tempMessageEvents = [];
12+
foreach ($values['MessageEvents'] as $messageEvent) {
13+
$obj = json_decode(json_encode($messageEvent));
14+
$postmarkMessage = new PostmarkMessageEvent((array)$obj);
15+
16+
$tempMessageEvents[] = $postmarkMessage;
17+
}
18+
$this->MessageEvents = $tempMessageEvents;
19+
}
20+
21+
public function getMessageEvents(): array
22+
{
23+
return $this->MessageEvents;
24+
}
25+
26+
public function setMessageEvents(array $MessageEvents): PostmarkMessageEvents
27+
{
28+
$this->MessageEvents = $MessageEvents;
29+
30+
return $this;
31+
}
32+
}

0 commit comments

Comments
 (0)