@@ -86,7 +86,7 @@ public function bcc(null|string|array|ArrayInterface|Address $bcc): self
8686 /**
8787 * Defines the subject of the email.
8888 */
89- public function withSubject (string |Stringable $ subject ): self
89+ public function subject (string |Stringable $ subject ): self
9090 {
9191 $ this ->subject = (string ) $ subject ;
9292
@@ -96,7 +96,7 @@ public function withSubject(string|Stringable $subject): self
9696 /**
9797 * Defines the HTML body of the email.
9898 */
99- public function withHtml (string |View $ html ): self
99+ public function html (string |View $ html ): self
100100 {
101101 $ this ->html = $ html ;
102102
@@ -106,7 +106,7 @@ public function withHtml(string|View $html): self
106106 /**
107107 * Defines the text body of the email.
108108 */
109- public function withText (string $ text ): self
109+ public function text (string $ text ): self
110110 {
111111 $ this ->text = $ text ;
112112
@@ -116,7 +116,7 @@ public function withText(string $text): self
116116 /**
117117 * Defines the priority of the email.
118118 */
119- public function withPriority (Priority |int $ priority ): self
119+ public function priority (Priority |int $ priority ): self
120120 {
121121 $ this ->priority = $ priority ;
122122
@@ -126,45 +126,33 @@ public function withPriority(Priority|int $priority): self
126126 /**
127127 * Defines the headers of the email.
128128 */
129- public function withHeaders (array $ headers ): self
129+ public function headers (array $ headers ): self
130130 {
131131 $ this ->headers = $ headers ;
132132
133133 return $ this ;
134134 }
135135
136136 /**
137- * Defines the attachments of the email.
138- *
139- * @param Attachment[] $attachments
137+ * Adds attachments to the email.
140138 */
141- public function withAttachments ( array $ attachments ): self
139+ public function attach ( Attachment ... $ attachments ): self
142140 {
143141 foreach ($ attachments as $ attachment ) {
144142 if (! ($ attachment instanceof Attachment)) {
145143 throw new \InvalidArgumentException (sprintf ('All attachments must be instances of `%s`. ' , Attachment::class));
146144 }
147- }
148-
149- $ this ->attachments = $ attachments ;
150-
151- return $ this ;
152- }
153145
154- /**
155- * Adds an attachment to the email.
156- */
157- public function withAttachment (Attachment $ attachment ): self
158- {
159- $ this ->attachments [] = $ attachment ;
146+ $ this ->attachments [] = $ attachment ;
147+ }
160148
161149 return $ this ;
162150 }
163151
164152 /**
165153 * Adds an attachment from the filesystem.
166154 */
167- public function withFileAttachment (string $ path , ?string $ name = null , ?string $ contentType = null ): self
155+ public function attachFromFileystem (string $ path , ?string $ name = null , ?string $ contentType = null ): self
168156 {
169157 $ this ->attachments [] = FileAttachment::fromPath ($ path , $ name , $ contentType );
170158
@@ -174,7 +162,7 @@ public function withFileAttachment(string $path, ?string $name = null, ?string $
174162 /**
175163 * Adds an attachment from the storage.
176164 */
177- public function withStorageAttachment (string $ path , ?string $ name = null , ?string $ contentType = null , null |string |UnitEnum $ tag = null ): self
165+ public function attachFromStorage (string $ path , ?string $ name = null , ?string $ contentType = null , null |string |UnitEnum $ tag = null ): self
178166 {
179167 $ this ->attachments [] = StorageAttachment::fromPath ($ path , $ name , $ contentType , $ tag );
180168
0 commit comments