protected function generateRequestHeaders(
        $verb,
        $resourceType,
        $resourceId,
        $isQuery = false,
        $contentLength = 0,
        array $extraHeaders = []
    ){
        $xMsDate = gmdate('D, d M Y H:i:s T');
        $headers = [
            'Accept: application/json',
            'User-Agent: ' . static::USER_AGENT,
            'Cache-Control: no-cache',
            'x-ms-date: ' . $xMsDate,
            'x-ms-version: ' . $this->apiVersion,
            'Authorization: ' . $this->generateAuthHeader($verb, $xMsDate, $resourceType, $resourceId)
        ];

        if (in_array($verb, [Verbs::POST, Verbs::PUT])) {
            $headers[] = 'Content-Length: ' . $contentLength;

            if ($isQuery === true) {
                $headers[] = 'Content-Type: application/query+json';
                $headers[] = 'x-ms-documentdb-isquery: True';
            } else {
                $headers[] = 'Content-Type: application/json';
            }
        }

        return array_merge($headers, $extraHeaders);
    }
protected function generateRequestHeaders(
        $verb,
        $resourceType,
        $resourceId,
        $isQuery = false,
        $contentLength = 0,
        array $extraHeaders = []
    ){
        $xMsDate = gmdate('D, d M Y H:i:s T');
        $headers = [
            'Accept: application/json',
            'User-Agent: ' . static::USER_AGENT,
            'Cache-Control: no-cache',
            'x-ms-date: ' . $xMsDate,
            'x-ms-version: ' . $this->apiVersion,
            'Authorization: ' . $this->generateAuthHeader($verb, $xMsDate, $resourceType, $resourceId)
        ];

        if (in_array($verb, [Verbs::POST, Verbs::PUT])) {
            $headers[] = 'Content-Length: ' . $contentLength;

            if ($isQuery === true) {
                $headers[] = 'Content-Type: application/query+json';
                $headers[] = 'x-ms-documentdb-isquery: True';
            } else {
                $headers[] = 'Content-Type: application/json';
            }
        }

        return array_merge($headers, $extraHeaders);
    }
protected function generateRequestHeaders ( $ verb , $ resourceType , $ resourceId , $ isQuery = false , $ contentLength = 0 , array $ extraHeaders = [ ] ) { $ xMsDate = gmdate ( 'D, d M Y H:i:s T' ) ; $ headers = [ 'Accept: application/json' , 'User-Agent: ' . static :: USER_AGENT , 'Cache-Control: no-cache' , 'x-ms-date: ' . $ xMsDate , 'x-ms-version: ' . $ this -> apiVersion , 'Authorization: ' . $ this -> generateAuthHeader ( $ verb , $ xMsDate , $ resourceType , $ resourceId ) ] ; if ( in_array ( $ verb , [ Verbs :: POST , Verbs :: PUT ] ) ) { $ headers [ ] = 'Content-Length: ' . $ contentLength ; if ( $ isQuery === true ) { $ headers [ ] = 'Content-Type: application/query+json' ; $ headers [ ] = 'x-ms-documentdb-isquery: True' ; } else { $ headers [ ] = 'Content-Type: application/json' ; } } return array_merge ( $ headers , $ extraHeaders ) ; }
Generates request headers based on request options.

@param string $verb          Request Method (HEAD, GET, POST, PUT, DELETE)
@param string $resourceType  Requested resource type
@param string $resourceId    Requested resource id
@param bool   $isQuery       Indicates if the request is query or not
@param int    $contentLength Content length of posted data
@param array  $extraHeaders  Additional request headers

@return array Array of request headers
Generates request headers based on request options .