src/Message/Helper/MultipartHelper.php
public function removePartByMimeType(Message $message, $mimeType, $index = 0)
    {
        $parts = $message->getAllParts(PartFilter::fromInlineContentType($mimeType));
        $alt = $message->getPart(0, PartFilter::fromInlineContentType('multipart/alternative'));
        if ($parts === null || !isset($parts[$index])) {
            return false;
        } elseif (count($parts) === 1) {
            return $this->removeAllContentPartsByMimeType($message, $mimeType, true);
        }
        $part = $parts[$index];
        $message->removePart($part);
        if ($alt !== null && $alt->getChildCount() === 1) {
            $this->genericHelper->replacePart($message, $alt, $alt->getChild(0));
        }
        return true;
    }
public function removePartByMimeType(Message $message, $mimeType, $index = 0)
    {
        $parts = $message->getAllParts(PartFilter::fromInlineContentType($mimeType));
        $alt = $message->getPart(0, PartFilter::fromInlineContentType('multipart/alternative'));
        if ($parts === null || !isset($parts[$index])) {
            return false;
        } elseif (count($parts) === 1) {
            return $this->removeAllContentPartsByMimeType($message, $mimeType, true);
        }
        $part = $parts[$index];
        $message->removePart($part);
        if ($alt !== null && $alt->getChildCount() === 1) {
            $this->genericHelper->replacePart($message, $alt, $alt->getChild(0));
        }
        return true;
    }
public function removePartByMimeType ( Message $ message , $ mimeType , $ index = 0 ) { $ parts = $ message -> getAllParts ( PartFilter :: fromInlineContentType ( $ mimeType ) ) ; $ alt = $ message -> getPart ( 0 , PartFilter :: fromInlineContentType ( 'multipart/alternative' ) ) ; if ( $ parts === null || ! isset ( $ parts [ $ index ] ) ) { return false ; } elseif ( count ( $ parts ) === 1 ) { return $ this -> removeAllContentPartsByMimeType ( $ message , $ mimeType , true ) ; } $ part = $ parts [ $ index ] ; $ message -> removePart ( $ part ) ; if ( $ alt !== null && $ alt -> getChildCount ( ) === 1 ) { $ this -> genericHelper -> replacePart ( $ message , $ alt , $ alt -> getChild ( 0 ) ) ; } return true ; }
Removes the 'inline' part with the passed contentType, at the given index
defaulting to the first

@param Message $message
@param string $mimeType
@param int $index
@return boolean true on success
Removes the inline part with the passed contentType at the given index defaulting to the first