private function isParentAlternative(int $partNo) : bool
{
// Multipart/alternative can be a child of only two types
if ($this->structure['ftype'][$partNo] != 'text/plain' && $this->structure['ftype'][$partNo] != 'text/plain') {
return false;
}
$partId = $this->structure['pid'][$partNo];
$partLevel = count(explode('.', $partId));
if (1 === $partLevel) {
return $this->isPartMultipart(0, 'alternative');
}
$parentId = substr($partId, 0, strrpos($partId, '.'));
for ($i = 0; $i < count($this->structure['pid']); $i++) {
// There can be multiple parts with the same Id (because we assign parent Id to parts without an own Id)
if ($parentId == $this->structure['pid'][$i] && $this->isPartMultipart($i, 'alternative')) {
return true;
}
}
return false;
}