11<?php
22
3- namespace Tempest \Mail \ Builder ;
3+ namespace Tempest \Mail ;
44
55use Stringable ;
66use Tempest \Mail \Address ;
7- use Tempest \Mail \Attachments \Attachment ;
8- use Tempest \Mail \Attachments \FileAttachment ;
9- use Tempest \Mail \Attachments \StorageAttachment ;
7+ use Tempest \Mail \Attachment ;
108use Tempest \Mail \Content ;
11- use Tempest \Mail \Email as EmailInterface ;
9+ use Tempest \Mail \Email ;
1210use Tempest \Mail \EmailPriority ;
1311use Tempest \Mail \Envelope ;
1412use Tempest \Mail \GenericEmail ;
13+ use Tempest \Storage \Storage ;
1514use Tempest \Support \Arr ;
1615use Tempest \Support \Arr \ArrayInterface ;
1716use Tempest \View \View ;
18- use UnitEnum ;
1917
2018/**
2119 * A builder class for creating email objects.
2220 */
23- final class Email
21+ final class EmailBuilder
2422{
2523 public function __construct (
2624 private(set) null |string |array |ArrayInterface |Address $ to = null ,
@@ -31,9 +29,9 @@ public function __construct(
3129 private(set) ?string $ subject = null ,
3230 private(set) null |string |View $ html = null ,
3331 private(set) ?string $ text = null ,
32+ private(set) array $ attachments = [],
3433 private(set) EmailPriority |int $ priority = EmailPriority::NORMAL ,
3534 private(set) array $ headers = [],
36- private(set) array $ attachments = [],
3735 ) {}
3836
3937 /**
@@ -157,25 +155,25 @@ public function attach(Attachment ...$attachments): self
157155 */
158156 public function attachFromFileystem (string $ path , ?string $ name = null , ?string $ contentType = null ): self
159157 {
160- $ this ->attachments [] = FileAttachment:: fromPath ($ path , $ name , $ contentType );
158+ $ this ->attachments [] = Attachment:: fromFilesystem ($ path , $ name , $ contentType );
161159
162160 return $ this ;
163161 }
164162
165163 /**
166164 * Adds an attachment from the storage.
167165 */
168- public function attachFromStorage (string $ path , ? string $ name = null , ?string $ contentType = null , null | string | UnitEnum $ tag = null ): self
166+ public function attachFromStorage (Storage $ storage , string $ path , ?string $ name = null , ? string $ contentType = null ): self
169167 {
170- $ this ->attachments [] = StorageAttachment:: fromPath ( $ path , $ name , $ contentType , $ tag );
168+ $ this ->attachments [] = Attachment:: fromStorage ( $ storage , $ path , $ name , $ contentType );
171169
172170 return $ this ;
173171 }
174172
175173 /**
176174 * Builds the email.
177175 */
178- public function make (): EmailInterface
176+ public function make (): Email
179177 {
180178 return new GenericEmail (
181179 envelope: new Envelope (
0 commit comments