src/Concerns/Request/Multipart.php
final public function prepareMultipartRequestPayloads(array $headers = [], array $body = [], array $files = []): array
    {
        $multipart = (($headers['Content-Type'] ?? null) == 'multipart/form-data');

        if (empty($files) && ! $multipart) {
            return [$headers, $body];
        }

        $builder = new Builder(StreamFactoryDiscovery::find());

        $this->addFilesToMultipartBuilder($builder, $files);
        $this->addBodyToMultipartBuilder(
            $builder, $this instanceof Filterable ? $this->filterRequest($body) : $body
        );

        $headers['Content-Type'] = 'multipart/form-data; boundary='.$builder->getBoundary();

        return [$headers, $builder->build()];
    }
final public function prepareMultipartRequestPayloads(array $headers = [], array $body = [], array $files = []): array
    {
        $multipart = (($headers['Content-Type'] ?? null) == 'multipart/form-data');

        if (empty($files) && ! $multipart) {
            return [$headers, $body];
        }

        $builder = new Builder(StreamFactoryDiscovery::find());

        $this->addFilesToMultipartBuilder($builder, $files);
        $this->addBodyToMultipartBuilder(
            $builder, $this instanceof Filterable ? $this->filterRequest($body) : $body
        );

        $headers['Content-Type'] = 'multipart/form-data; boundary='.$builder->getBoundary();

        return [$headers, $builder->build()];
    }
final public function prepareMultipartRequestPayloads ( array $ headers = [ ] , array $ body = [ ] , array $ files = [ ] ) : array { $ multipart = ( ( $ headers [ 'Content-Type' ] ?? null ) == 'multipart/form-data' ) ; if ( empty ( $ files ) && ! $ multipart ) { return [ $ headers , $ body ] ; } $ builder = new Builder ( StreamFactoryDiscovery :: find ( ) ) ; $ this -> addFilesToMultipartBuilder ( $ builder , $ files ) ; $ this -> addBodyToMultipartBuilder ( $ builder , $ this instanceof Filterable ? $ this -> filterRequest ( $ body ) : $ body ) ; $ headers [ 'Content-Type' ] = 'multipart/form-data; boundary=' . $ builder -> getBoundary ( ) ; return [ $ headers , $ builder -> build ( ) ] ; }
Prepare multipart request payloads.

@param  array  $headers
@param  array  $body
@param  array  $files

@return array
Prepare multipart request payloads .