private function injectContentType(string $contentType, array $headers): array
    {
        $hasContentType = \array_reduce(\array_keys($headers), static function ($carry, $item) {
            return $carry ?: (\strtolower($item) === 'content-type');
        }, false);

        if (! $hasContentType) {
            $headers['Content-Type'] = [$contentType];
        }

        return $headers;
    }
private function injectContentType(string $contentType, array $headers): array
    {
        $hasContentType = \array_reduce(\array_keys($headers), static function ($carry, $item) {
            return $carry ?: (\strtolower($item) === 'content-type');
        }, false);

        if (! $hasContentType) {
            $headers['Content-Type'] = [$contentType];
        }

        return $headers;
    }
private function injectContentType ( string $ contentType , array $ headers ) : array { $ hasContentType = \ array_reduce ( \ array_keys ( $ headers ) , static function ( $ carry , $ item ) { return $ carry ? : ( \ strtolower ( $ item ) === 'content-type' ) ; } , false ) ; if ( ! $ hasContentType ) { $ headers [ 'Content-Type' ] = [ $ contentType ] ; } return $ headers ; }
Inject the provided Content-Type, if none is already present.

@param string $contentType
@param array  $headers

@return array Headers with injected Content-Type
Inject the provided Content - Type if none is already present .