public function parseBody(string $pid = null, string $mimeType = 'text/html', bool $alternative = true, bool $all = false)
{
try {
$this->checkIfParsed();
} catch (\Jyxo\Mail\Parser\EmailNotExistException $e) {
throw $e;
}
if (null === $pid) {
$pid = $this->defaultPid;
}
// If only one part exists, it is already parsed
if (count($this->structure['pid']) > 1) {
$key = array_search($pid, $this->structure['pid']);
if (false !== $key) {
if ($all) {
$this->parseMultiparts($pid, $mimeType, 'all', 2, $alternative);
} else {
if ($pid == $this->defaultPid) {
$this->parseMultiparts($pid, $mimeType, 'top', 2, $alternative);
} elseif ('message/rfc822' == $this->structure['ftype'][1]) {
$this->parseMultiparts($pid, $mimeType, 'subparts', 1, $alternative);
}
}
}
}
}