22
33namespace G4 \Mailer \Message ;
44
5-
6- class ZendMessageFacade
5+ class LaminasMessageFacade
76{
87 const ENCODING = 'utf-8 ' ;
98 const TYPE_HTML = 'text/html ' ;
109 const TYPE_TEXT = 'text/plain ' ;
1110
12- /**
13- * @param \G4\Mailer\Message $message
14- * @return \Zend\Mail\Message
15- */
16- public static function convert (\G4 \Mailer \Message $ message )
11+ public static function convert (\G4 \Mailer \Message $ message ): \Laminas \Mail \Message
1712 {
18- $ htmlPart = new \Zend \Mime \Part ($ message ->getHtmlBody ());
13+ $ htmlPart = new \Laminas \Mime \Part ($ message ->getHtmlBody ());
1914 $ htmlPart ->charset = self ::ENCODING ;
2015 $ htmlPart ->type = self ::TYPE_HTML ;
21- $ htmlPart ->encoding = \Zend \Mime \Mime::ENCODING_QUOTEDPRINTABLE ;
16+ $ htmlPart ->encoding = \Laminas \Mime \Mime::ENCODING_QUOTEDPRINTABLE ;
2217
23- $ textPart = new \Zend \Mime \Part ($ message ->getTextBody ());
18+ $ textPart = new \Laminas \Mime \Part ($ message ->getTextBody ());
2419 $ textPart ->charset = self ::ENCODING ;
2520 $ textPart ->type = self ::TYPE_TEXT ;
26- $ textPart ->encoding = \Zend \Mime \Mime::ENCODING_QUOTEDPRINTABLE ;
21+ $ textPart ->encoding = \Laminas \Mime \Mime::ENCODING_QUOTEDPRINTABLE ;
2722
28- $ body = new \Zend \Mime \Message ();
23+ $ body = new \Laminas \Mime \Message ();
2924 $ body ->setParts ([$ textPart , $ htmlPart ]);
3025
31- $ zendMessage = new \Zend \Mail \Message ();
32- $ zendMessage
26+ $ laminasMessage = new \Laminas \Mail \Message ();
27+ $ laminasMessage
3328 ->addTo ($ message ->getTo ())
3429 ->addFrom (
3530 self ::getEmailPart ($ message ->getFrom ()),
@@ -45,22 +40,22 @@ public static function convert(\G4\Mailer\Message $message)
4540 ->getHeaders ()->get ('content-type ' )->setType ('multipart/alternative ' );
4641
4742 if (count ($ message ->getCc ())) {
48- $ zendMessage ->addCc ($ message ->getCc ());
43+ $ laminasMessage ->addCc ($ message ->getCc ());
4944 }
5045 if (count ($ message ->getBcc ())) {
51- $ zendMessage ->addBcc ($ message ->getBcc ());
46+ $ laminasMessage ->addBcc ($ message ->getBcc ());
5247 }
5348 if ($ message ->getReplyTo ()) {
54- $ zendMessage ->setReplyTo (
49+ $ laminasMessage ->setReplyTo (
5550 self ::getEmailPart ($ message ->getReplyTo ()),
5651 self ::getNamePart ($ message ->getReplyTo ())
5752 );
5853 }
5954 if ($ message ->hasHeaders ()) {
60- $ zendMessage ->getHeaders ()->addHeaders ($ message ->getHeaders ());
55+ $ laminasMessage ->getHeaders ()->addHeaders ($ message ->getHeaders ());
6156 }
6257
63- return $ zendMessage ;
58+ return $ laminasMessage ;
6459 }
6560
6661 private static function getEmailPart ($ from )
@@ -80,4 +75,4 @@ private static function getNamePart($from)
8075 }
8176 return null ;
8277 }
83- }
78+ }
0 commit comments