protected function parseBody($stream, $uid)
    {
        $struct = imap_fetchstructure($stream, $uid, static::$fetchFlags);

        if (!isset($struct->parts)) {
            return array_filter([$this->parsePart($stream, $uid, $struct)]);
        }

        $parsedParts = [];
        foreach ($this->flattenParts($struct->parts) as $partNo => $part) {
            $parsedParts[] = $this->parsePart($stream, $uid, $part, $partNo);
        }
        return array_filter($parsedParts);
    }