@@ -93,6 +93,7 @@ public function __construct(ImapDriver $driver, $structure, $mailId, Mailbox $ma
9393
9494 /**
9595 * @return array
96+ * @internal use only with caution, format can change without warning
9697 */
9798 public function getRawStructure ()
9899 {
@@ -115,9 +116,9 @@ public function getHtmlBody()
115116 if ($ this ->htmlBody === NULL ) {
116117 $ this ->driver ->switchMailbox ($ this ->mailbox ->getName ());
117118 return $ this ->htmlBody = $ this ->driver ->getBody ($ this ->id , $ this ->htmlBodyIds );
118- } else {
119- return $ this ->htmlBody ;
120119 }
120+
121+ return $ this ->htmlBody ;
121122 }
122123
123124 /**
@@ -128,9 +129,9 @@ public function getTextBody()
128129 if ($ this ->textBody === NULL ) {
129130 $ this ->driver ->switchMailbox ($ this ->mailbox ->getName ());
130131 return $ this ->textBody = $ this ->driver ->getBody ($ this ->id , $ this ->textBodyIds );
131- } else {
132- return $ this ->textBody ;
133132 }
133+
134+ return $ this ->textBody ;
134135 }
135136
136137 /**
@@ -148,13 +149,21 @@ public function getAttachments()
148149 return $ this ->attachments ;
149150 }
150151
151- /** @return MimePart[] */
152- public function getParts (): array
152+ /**
153+ * @return MimePart[]
154+ */
155+ public function getMimeParts ()
153156 {
154157 $ this ->driver ->switchMailbox ($ this ->mailbox ->getName ());
155158 return $ this ->messageParts ;
156159 }
157160
161+ /** @deprecated use getMimeParts() instead */
162+ public function getParts () {
163+ \trigger_error (\E_USER_DEPRECATED , 'use getMimeParts() instead ' );
164+ return $ this ->getMimeParts ();
165+ }
166+
158167 protected function addStructurePart ($ structure , $ partId )
159168 {
160169 $ type = $ structure ->type ;
@@ -173,12 +182,15 @@ protected function addStructurePart($structure, $partId)
173182 }
174183 }
175184
185+ /** @noinspection NestedTernaryOperatorInspection Yep, will fix this when we switch to PHP7 level; see ?? operator */
176186 $ this ->messageParts [] = new MimePart (
177187 $ this ->driver ,
178188 $ this ->id ,
179189 $ partId ,
180190 self ::$ typeTable [$ type ]. '/ ' . $ subtype ,
181- $ parameters ['filename ' ] ?? $ parameters ['name ' ] ?? '' ,
191+ (empty ($ parameters ['filename ' ]) ? $ parameters ['filename ' ] : (
192+ empty ($ parameters ['name ' ]) ? $ parameters ['name ' ] : ''
193+ )),
182194 $ encoding
183195 );
184196
0 commit comments