encoding = strtolower($encoding); parent::__construct($type, $subtype, $attributes); } public function body(): string { return (string) $this->body; } public function decodedBody(): string { return match ($this->encoding) { 'quoted-printable' => quoted_printable_decode($this->body()), 'base64' => base64_decode($this->body()), default => $this->body(), }; } public function charset(): string { return $this->charset; } public function encoding(): string { return $this->encoding; } public function disposition(): ?Disposition { return $this->disposition; } public function findPartByMimeType(string $mimeType): ?SinglePart { if ($this->mimeType() === strtolower($mimeType)) { return $this; } return null; } }