/** * Parse the subject of the email. */ public function parseSubject() { //Transfer first the subject form the email (if any) $this->message->setSubject($this->email->getSubject()); /* * When the subject is empty AND we have a template, simply take the subject of the template */ if (!empty($this->message->getSubject()) && !is_null($this->template)) { $this->message->setSubject($this->template->getSubject()); } /* * Go over the templateVars to replace content in the subject */ foreach ($this->templateVars as $key => $replace) { /* * Skip the service manager */ if ($replace instanceof ServiceManager) { continue; } /* * replace the content of the title with the available keys in the template vars */ if (!is_array($replace)) { $this->message->setSubject(str_replace(sprintf("[%s]", $key), $replace, $this->message->getSubject())); } } }