src/EventIntakeRequest.php
public function getRequestBody(): string
    {
        if ($this->metadata === null) {
            throw new BadEventRequestException('Metadata must be defined!');
        }

        $json = $this->serializer->encode(
            ['metadata' => $this->serializer->normalize($this->metadata)],
            JsonEncoder::FORMAT
        );

        $json .= "\n";

        foreach ($this->transactions as $transaction) {
            $json .= "\n";
            $json .= $this->serializer->encode(
                ['transaction' => $this->serializer->normalize($transaction)],
                JsonEncoder::FORMAT
            );
        }

        $json .= "\n";

        foreach ($this->spans as $span) {
            $json .= "\n";
            $json .= $this->serializer->encode(
                ['span' => $this->serializer->normalize($span)],
                JsonEncoder::FORMAT
            );
        }

        $json .= "\n";

        foreach ($this->errors as $error) {
            $json .= "\n";
            $json .= $this->serializer->encode(
                ['error' => $this->serializer->normalize($error)],
                JsonEncoder::FORMAT
            );
        }

        return $json;
    }
public function getRequestBody(): string
    {
        if ($this->metadata === null) {
            throw new BadEventRequestException('Metadata must be defined!');
        }

        $json = $this->serializer->encode(
            ['metadata' => $this->serializer->normalize($this->metadata)],
            JsonEncoder::FORMAT
        );

        $json .= "\n";

        foreach ($this->transactions as $transaction) {
            $json .= "\n";
            $json .= $this->serializer->encode(
                ['transaction' => $this->serializer->normalize($transaction)],
                JsonEncoder::FORMAT
            );
        }

        $json .= "\n";

        foreach ($this->spans as $span) {
            $json .= "\n";
            $json .= $this->serializer->encode(
                ['span' => $this->serializer->normalize($span)],
                JsonEncoder::FORMAT
            );
        }

        $json .= "\n";

        foreach ($this->errors as $error) {
            $json .= "\n";
            $json .= $this->serializer->encode(
                ['error' => $this->serializer->normalize($error)],
                JsonEncoder::FORMAT
            );
        }

        return $json;
    }
public function getRequestBody ( ) : string { if ( $ this -> metadata === null ) { throw new BadEventRequestException ( 'Metadata must be defined!' ) ; } $ json = $ this -> serializer -> encode ( [ 'metadata' => $ this -> serializer -> normalize ( $ this -> metadata ) ] , JsonEncoder :: FORMAT ) ; $ json .= "\n" ; foreach ( $ this -> transactions as $ transaction ) { $ json .= "\n" ; $ json .= $ this -> serializer -> encode ( [ 'transaction' => $ this -> serializer -> normalize ( $ transaction ) ] , JsonEncoder :: FORMAT ) ; } $ json .= "\n" ; foreach ( $ this -> spans as $ span ) { $ json .= "\n" ; $ json .= $ this -> serializer -> encode ( [ 'span' => $ this -> serializer -> normalize ( $ span ) ] , JsonEncoder :: FORMAT ) ; } $ json .= "\n" ; foreach ( $ this -> errors as $ error ) { $ json .= "\n" ; $ json .= $ this -> serializer -> encode ( [ 'error' => $ this -> serializer -> normalize ( $ error ) ] , JsonEncoder :: FORMAT ) ; } return $ json ; }
Returns NDJSON request body
@throws BadEventRequestException
Returns NDJSON request body