Skip to content

Commit

Permalink
Merge pull request #2 from Degox/patch-1
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
vragovR authored Jun 25, 2018
2 parents 16373bd + f100926 commit 8f3239c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Service/EmailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use NotificationBundle\Exception\SubjectTemplateException;
use NotificationBundle\Model\Message;
use Symfony\Bundle\TwigBundle\TwigEngine;
use Symfony\Component\Templating\EngineInterface;
use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;

/**
Expand All @@ -32,9 +33,9 @@ class EmailService
protected $mailer;

/**
* @var TwigEngine
* @var EngineInterface
*/
protected $twig;
protected $templateEngine;

/**
* @var Html2Text
Expand All @@ -60,16 +61,16 @@ class EmailService
* EmailService constructor.
*
* @param \Swift_Mailer $mailer
* @param TwigEngine $twig
* @param TwigEngine $templateEngine
* @param array $params
*/
public function __construct(
\Swift_Mailer $mailer,
TwigEngine $twig,
EngineInterface $templateEngine,
array $params
) {
$this->mailer = $mailer;
$this->twig = $twig;
$this->templateEngine = $templateEngine;
$this->html2text = new Html2Text();
$this->cssToInlineStyles = new CssToInlineStyles();
$this->params = $params;
Expand Down Expand Up @@ -175,7 +176,7 @@ protected function getSubject(): string
$this->params['template']['subject_name'],
]);

if (!$this->twig->exists($path)) {
if (!$this->templateEngine->exists($path)) {
throw new SubjectTemplateException('Subject template is not exist.');
}

Expand All @@ -194,7 +195,7 @@ protected function getHtmlMessage(\Swift_Message $message): string
$this->params['template']['html_name'],
]);

if (!$this->twig->exists($path)) {
if (!$this->templateEngine->exists($path)) {
throw new HtmlTemplateException('HTML template is not exist.');
}

Expand Down Expand Up @@ -244,7 +245,7 @@ protected function getInlineStyles(array $cssList): string
*/
protected function render($template, array $params): string
{
return $this->twig->render(
return $this->templateEngine->render(
$template,
array_merge(
$params,
Expand Down

0 comments on commit 8f3239c

Please sign in to comment.