getParent()->removePart(); ```. * * @param IMessagePart $part The part to remove * * @return int|null The previous index position of the part within its old * parent. */ public function removePart(IMessagePart $part): ?int; /** * Removes all parts below the current part. If a callable filter is * passed, removes only those matching the passed filter. The number of * removed parts is returned. * * Note: the current part will not be removed. Although the function naming * matches getAllParts, which returns the current part, it also doesn't only * remove direct children like getChildParts. Internally this function uses * getAllParts but the current part is filtered out if returned. * * @param callable $fnFilter Optional function accepting an IMessagePart and * returning true if the part should be included. * * @return int The number of removed parts. */ public function removeAllParts($fnFilter = null): int; }