Skip to content

Commit

Permalink
[Twig Bridge] Add PHPdoc information to some email methods
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Dec 2, 2022
1 parent a908cd1 commit 4f3bc60
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Mime/WrappedTemplatedEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public function toName(): string
return $this->message->getTo()[0]->getName();
}

/**
* @param string $image A Twig path to the image file. It's recommended to define
* some Twig namespace for email images (e.g. '@email/images/logo.png').
* @param string|null $contentType The media type (i.e. MIME type) of the image file (e.g. 'image/png').
* Some email clients require this to display embedded images.
*/
public function image(string $image, string $contentType = null): string
{
$file = $this->twig->getLoader()->getSourceContext($image);
Expand All @@ -47,6 +53,13 @@ public function image(string $image, string $contentType = null): string
return 'cid:'.$image;
}

/**
* @param string $file A Twig path to the file. It's recommended to define
* some Twig namespace for email files (e.g. '@email/files/contract.pdf').
* @param string|null $name A custom file name that overrides the original name of the attached file.
* @param string|null $contentType The media type (i.e. MIME type) of the file (e.g. 'application/pdf').
* Some email clients require this to display attached files.
*/
public function attach(string $file, string $name = null, string $contentType = null): void
{
$file = $this->twig->getLoader()->getSourceContext($file);
Expand Down

0 comments on commit 4f3bc60

Please sign in to comment.