append(base64_encode($data)); } /** * @inheritdoc * @return string */ function decode(Body $body) : string { $data = base64_decode($body, true); if (false === $data) { $e = error_get_last(); throw new UnexpectedValueException("Could not decode BASE64: ". ($e ? $e["message"] : "Unknown error")); } return $data; } }