File tree Expand file tree Collapse file tree 3 files changed +69
-3
lines changed
Expand file tree Collapse file tree 3 files changed +69
-3
lines changed Original file line number Diff line number Diff line change 22
33namespace DirectoryTree \ImapEngine ;
44
5- class Address
5+ use Illuminate \Contracts \Support \Arrayable ;
6+ use JsonSerializable ;
7+
8+ class Address implements Arrayable, JsonSerializable
69{
710 /**
811 * Constructor.
@@ -27,4 +30,23 @@ public function name(): string
2730 {
2831 return $ this ->name ;
2932 }
33+
34+ /**
35+ * Get the array representation of the address.
36+ */
37+ public function toArray (): array
38+ {
39+ return [
40+ 'email ' => $ this ->email ,
41+ 'name ' => $ this ->name ,
42+ ];
43+ }
44+
45+ /**
46+ * Get the JSON representation of the address.
47+ */
48+ public function jsonSerialize (): array
49+ {
50+ return $ this ->toArray ();
51+ }
3052}
Original file line number Diff line number Diff line change 22
33namespace DirectoryTree \ImapEngine ;
44
5+ use Illuminate \Contracts \Support \Arrayable ;
6+ use JsonSerializable ;
57use Psr \Http \Message \StreamInterface ;
68use Symfony \Component \Mime \MimeTypes ;
79
8- class Attachment
10+ class Attachment implements Arrayable, JsonSerializable
911{
1012 /**
1113 * Constructor.
@@ -71,4 +73,24 @@ public function extension(): ?string
7173
7274 return null ;
7375 }
76+
77+ /**
78+ * Get the array representation of the attachment.
79+ */
80+ public function toArray (): array
81+ {
82+ return [
83+ 'filename ' => $ this ->filename ,
84+ 'contentType ' => $ this ->contentType ,
85+ 'contents ' => $ this ->contents (),
86+ ];
87+ }
88+
89+ /**
90+ * Get the JSON representation of the attachment.
91+ */
92+ public function jsonSerialize (): array
93+ {
94+ return $ this ->toArray ();
95+ }
7496}
Original file line number Diff line number Diff line change 77use DirectoryTree \ImapEngine \Enums \ImapFetchIdentifier ;
88use DirectoryTree \ImapEngine \Exceptions \Exception ;
99use DirectoryTree \ImapEngine \Exceptions \ImapCapabilityException ;
10+ use Illuminate \Contracts \Support \Arrayable ;
11+ use JsonSerializable ;
1012
11- class Folder
13+ class Folder implements Arrayable, JsonSerializable
1214{
1315 /**
1416 * The folder's cached capabilities.
@@ -206,4 +208,24 @@ protected function capabilities(): array
206208 {
207209 return $ this ->capabilities ??= $ this ->mailbox ->capabilities ();
208210 }
211+
212+ /**
213+ * Get the array representation of the folder.
214+ */
215+ public function toArray (): array
216+ {
217+ return [
218+ 'path ' => $ this ->path ,
219+ 'flags ' => $ this ->flags ,
220+ 'delimiter ' => $ this ->delimiter ,
221+ ];
222+ }
223+
224+ /**
225+ * Get the JSON representation of the folder.
226+ */
227+ public function jsonSerialize (): array
228+ {
229+ return $ this ->toArray ();
230+ }
209231}
You can’t perform that action at this time.
0 commit comments