diff --git a/src/Abstracts/EmailAbstract.php b/src/Abstracts/EmailAbstract.php index 587caafa6c123198cd4a771f9968a24f077f30d9..4b2612ec5a85cdf3fc815487900a3f876074563b 100644 --- a/src/Abstracts/EmailAbstract.php +++ b/src/Abstracts/EmailAbstract.php @@ -58,6 +58,9 @@ abstract class EmailAbstract implements EmailInterface { */ abstract public function get_id(): string; + /** + * @return string + */ public function get_template_name(): string { return 'default'; } @@ -298,6 +301,10 @@ abstract class EmailAbstract implements EmailInterface { * @return array|string|string[] */ protected function replace_placeholders( string $string ): string { + if ( empty( $this->placeholders ) ) { + return $string; + } + return (string) str_replace( array_keys( $this->placeholders ), array_values( $this->placeholders ), $string ); } diff --git a/src/Abstracts/EmailInterface.php b/src/Abstracts/EmailInterface.php index 35e9469e23b56396895af57c3f9c9a42b0dd25a3..61a4ea8a251125fdfef9659567cb7696648a24ac 100644 --- a/src/Abstracts/EmailInterface.php +++ b/src/Abstracts/EmailInterface.php @@ -11,6 +11,13 @@ interface EmailInterface { */ public function get_id(): string; + /** + * Get template name. + * + * @return string + */ + public function get_template_name(): string; + /** * @return string */