ContentTypes::PROTOBUF, self::HTTP_PROTOBUF => ContentTypes::PROTOBUF, self::HTTP_JSON => ContentTypes::JSON, self::HTTP_NDJSON => ContentTypes::NDJSON, ]; public static function validate(string $protocol): void { if (!array_key_exists($protocol, self::PROTOCOLS)) { throw new UnexpectedValueException('Unknown protocol: ' . $protocol); } } public static function contentType(string $protocol): string { self::validate($protocol); return self::PROTOCOLS[$protocol]; } }