Code Duplication    Length = 16-18 lines in 2 locations

lib/classes/Swift/Mime/SimpleMessage.php 2 locations

@@ 581-598 (lines=18) @@
578
     *
579
     * @return string
580
     */
581
    public function toString()
582
    {
583
        $children = $this->getChildren();
584
585
        if (
586
            count($children) > 0
587
            &&
588
            $this->getBody() // WARNING: don't try to use strict comparision here
589
        ) {
590
            $this->setChildren(array_merge(array($this->_becomeMimePart()), $children));
591
            $string = parent::toString();
592
            $this->setChildren($children);
593
        } else {
594
            $string = parent::toString();
595
        }
596
597
        return $string;
598
    }
599
600
    /**
601
     * Returns a string representation of this object.
@@ 617-632 (lines=16) @@
614
     *
615
     * @param Swift_InputByteStream $is
616
     */
617
    public function toByteStream(Swift_InputByteStream $is)
618
    {
619
        $children = $this->getChildren();
620
621
        if (
622
            count($children) > 0
623
            &&
624
            $this->getBody() // WARNING: don't try to use strict comparision here
625
        ) {
626
            $this->setChildren(array_merge(array($this->_becomeMimePart()), $children));
627
            parent::toByteStream($is);
628
            $this->setChildren($children);
629
        } else {
630
            parent::toByteStream($is);
631
        }
632
    }
633
634
    /** @see Swift_Mime_SimpleMimeEntity::_getIdField() */
635
    protected function _getIdField()