src/Http/Formatting/RequestParser.php
public function readAsMultipart($request): ?MultipartBody
    {
        if (!$request instanceof IHttpRequestMessage && !$request instanceof MultipartBodyPart) {
            throw new InvalidArgumentException(
                'Request must be of type ' . IHttpRequestMessage::class . ' or ' . MultipartBodyPart::class
            );
        }

        $boundary = null;

        if (!$this->headerParser->parseParameters($request->getHeaders(), 'Content-Type')->tryGet(
            'boundary',
            $boundary
        )) {
            throw new InvalidArgumentException('"boundary" is missing in Content-Type header');
        }

        return $this->bodyParser->readAsMultipart($request->getBody(), $boundary);
    }
public function readAsMultipart($request): ?MultipartBody
    {
        if (!$request instanceof IHttpRequestMessage && !$request instanceof MultipartBodyPart) {
            throw new InvalidArgumentException(
                'Request must be of type ' . IHttpRequestMessage::class . ' or ' . MultipartBodyPart::class
            );
        }

        $boundary = null;

        if (!$this->headerParser->parseParameters($request->getHeaders(), 'Content-Type')->tryGet(
            'boundary',
            $boundary
        )) {
            throw new InvalidArgumentException('"boundary" is missing in Content-Type header');
        }

        return $this->bodyParser->readAsMultipart($request->getBody(), $boundary);
    }
public function readAsMultipart ( $ request ) : ? MultipartBody { if ( ! $ request instanceof IHttpRequestMessage && ! $ request instanceof MultipartBodyPart ) { throw new InvalidArgumentException ( 'Request must be of type ' . IHttpRequestMessage :: class . ' or ' . MultipartBodyPart :: class ) ; } $ boundary = null ; if ( ! $ this -> headerParser -> parseParameters ( $ request -> getHeaders ( ) , 'Content-Type' ) -> tryGet ( 'boundary' , $ boundary ) ) { throw new InvalidArgumentException ( '"boundary" is missing in Content-Type header' ) ; } return $ this -> bodyParser -> readAsMultipart ( $ request -> getBody ( ) , $ boundary ) ; }
Parses a request as a multipart request
Note: This method should only be called once for best performance

@param IHttpRequestMessage|MultipartBodyPart $request The request or multipart body part to parse
@return MultipartBody|null The multipart body if it was set, otherwise null
@throws InvalidArgumentException Thrown if the request is not a multipart request
@throws RuntimeException Thrown if the headers' hash keys could not be calculated
Parses a request as a multipart request Note : This method should only be called once for best performance