Code Duplication    Length = 9-12 lines in 2 locations

src/Message.php 2 locations

@@ 195-203 (lines=9) @@
192
     *
193
     * @return string | null Null if message has no HTML message part
194
     */
195
    public function getBodyHtml()
196
    {
197
        $iterator = new \RecursiveIteratorIterator($this, \RecursiveIteratorIterator::SELF_FIRST);
198
        foreach ($iterator as $part) {
199
            if ($part->getSubtype() == 'HTML') {
200
                return $part->getDecodedContent($this->keepUnseen);
201
            }
202
        }
203
    }
204
205
    /**
206
     * Get body text
@@ 210-221 (lines=12) @@
207
     *
208
     * @return string
209
     */
210
    public function getBodyText()
211
    {
212
        $iterator = new \RecursiveIteratorIterator($this, \RecursiveIteratorIterator::SELF_FIRST);
213
        foreach ($iterator as $part) {
214
            if ($part->getSubtype() == 'PLAIN') {
215
                return $part->getDecodedContent($this->keepUnseen);
216
            }
217
        }
218
219
        // If message has no parts, return content of message itself.
220
        return $this->getDecodedContent($this->keepUnseen);
221
    }
222
223
    /**
224
     * Get attachments (if any) linked to this e-mail