private function setContentType($value) { $mapping = ['text/xml' => 'text/xml', 'xml' => 'text/xml', 'application/xml' => 'text/xml', 'html-fragment' => 'text/html', 'text/html-fragment' => 'text/html', 'html' => 'text/html', 'text/html' => 'text/html']; $normalizedValue = strtolower($value); if (array_key_exists($normalizedValue, $mapping)) { $newContentType = $mapping[$normalizedValue]; } else { $newContentType = $value; } if (isset($this->_parent) && $this->_contentType != $newContentType) { $this->_parent->contentType = $newContentType; } $this->_contentType = $newContentType; }