private function writeResponse(&$responsePayload) { $gzipEncode = RPCServletUtils::acceptsGzipEncoding() && $this->shouldCompressResponse($responsePayload); RPCServletUtils::writeResponse($responsePayload, $gzipEncode); }
public static function encodeResponseForFailure(Method $serviceMethod, Throwable $cause, SerializationPolicy $serializationPolicy = null, $flags = AbstractSerializationStream::DEFAULT_FLAGS) { if (is_null($cause)) { throw new NullPointerException('cause cannot be null'); } if (is_null($serializationPolicy)) { //throw new NullPointerException('serializationPolicy cannot be null'); $serializationPolicy = self::getDefaultSerializationPolicy(); } if (!is_null($serviceMethod) && !RPCServletUtils::isExpectedException($serviceMethod, $cause)) { $cause = (string) $cause; $source = self::getSourceRepresentation($serviceMethod); throw new UnexpectedException("Service method '{$source}' threw an unexpected excetion: {$cause}"); } return self::encodeResponse($cause->getClass(), $cause, true, $flags, $serializationPolicy); }