public static function decodeBody(string $body, string $encoding) : string { switch ($encoding) { case 'quoted-printable': return quoted_printable_decode($body); case 'base64': return imap_base64($body); default: return $body; } }