Skip to content

Commit dba7c18

Browse files
author
Bartosz Walaszczyk
committed
APPDEV-5359 added optional file name to LocalFileAttachment construct
1 parent de3c0ca commit dba7c18

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Messaging/Mail/LocalFileAttachment.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ class LocalFileAttachment implements AttachmentInterface
2424
/**
2525
* Attachment constructor.
2626
* @param string $filepath
27-
* @throws ExternalFileException
27+
* @param string|null $name
2828
* @throws FileDoesNotExistException
2929
*/
30-
public function __construct(string $filepath)
30+
public function __construct(string $filepath, string $name = null)
3131
{
3232
$this->validate($filepath);
33-
$this->name = basename($filepath);
33+
$this->name = $name ?? basename($filepath);
3434
$this->content = base64_encode(rtrim(file_get_contents($filepath)));
3535
}
3636

0 commit comments

Comments
 (0)