src/Riak/Api/Http.php
protected function prepareRequestHeaders()
    {
        $curl_headers = [];

        foreach ($this->headers as $key => $value) {
            $curl_headers[] = sprintf('%s: %s', $key, $value);
        }

        // if we have an object, set appropriate object headers
        $object = $this->command->getObject();
        if ($object) {
            if ($object->getVclock()) {
                $curl_headers[] = sprintf('%s: %s', static::VCLOCK_KEY, $object->getVclock());
            }

            if ($object->getContentType()) {
                $charset = '';
                if ($object->getCharset()) {
                    $charset = sprintf('; charset=%s', $object->getCharset());
                }
                $curl_headers[] = sprintf('%s: %s', static::CONTENT_TYPE_KEY, $object->getContentType(), $charset);
            }

            // setup index headers
            $translator = new Api\Http\Translator\SecondaryIndex();
            $indexHeaders = $translator->createHeadersFromIndexes($object->getIndexes());
            foreach ($indexHeaders as $value) {
                $curl_headers[] = sprintf('%s: %s', $value[0], $value[1]);
            }

            // setup metadata headers
            foreach($object->getMetaData() as $key => $value) {
                $curl_headers[] = sprintf('%s%s: %s', static::METADATA_PREFIX, $key, $value);
            }
        }

        // set the request headers on the connection
        $this->options[CURLOPT_HTTPHEADER] = $curl_headers;

        // dump local headers to start fresh
        $this->headers = [];

        return $this;
    }
protected function prepareRequestHeaders()
    {
        $curl_headers = [];

        foreach ($this->headers as $key => $value) {
            $curl_headers[] = sprintf('%s: %s', $key, $value);
        }

        // if we have an object, set appropriate object headers
        $object = $this->command->getObject();
        if ($object) {
            if ($object->getVclock()) {
                $curl_headers[] = sprintf('%s: %s', static::VCLOCK_KEY, $object->getVclock());
            }

            if ($object->getContentType()) {
                $charset = '';
                if ($object->getCharset()) {
                    $charset = sprintf('; charset=%s', $object->getCharset());
                }
                $curl_headers[] = sprintf('%s: %s', static::CONTENT_TYPE_KEY, $object->getContentType(), $charset);
            }

            // setup index headers
            $translator = new Api\Http\Translator\SecondaryIndex();
            $indexHeaders = $translator->createHeadersFromIndexes($object->getIndexes());
            foreach ($indexHeaders as $value) {
                $curl_headers[] = sprintf('%s: %s', $value[0], $value[1]);
            }

            // setup metadata headers
            foreach($object->getMetaData() as $key => $value) {
                $curl_headers[] = sprintf('%s%s: %s', static::METADATA_PREFIX, $key, $value);
            }
        }

        // set the request headers on the connection
        $this->options[CURLOPT_HTTPHEADER] = $curl_headers;

        // dump local headers to start fresh
        $this->headers = [];

        return $this;
    }
protected function prepareRequestHeaders ( ) { $ curl_headers = [ ] ; foreach ( $ this -> headers as $ key => $ value ) { $ curl_headers [ ] = sprintf ( '%s: %s' , $ key , $ value ) ; } // if we have an object, set appropriate object headers $ object = $ this -> command -> getObject ( ) ; if ( $ object ) { if ( $ object -> getVclock ( ) ) { $ curl_headers [ ] = sprintf ( '%s: %s' , static :: VCLOCK_KEY , $ object -> getVclock ( ) ) ; } if ( $ object -> getContentType ( ) ) { $ charset = '' ; if ( $ object -> getCharset ( ) ) { $ charset = sprintf ( '; charset=%s' , $ object -> getCharset ( ) ) ; } $ curl_headers [ ] = sprintf ( '%s: %s' , static :: CONTENT_TYPE_KEY , $ object -> getContentType ( ) , $ charset ) ; } // setup index headers $ translator = new Api \ Http \ Translator \ SecondaryIndex ( ) ; $ indexHeaders = $ translator -> createHeadersFromIndexes ( $ object -> getIndexes ( ) ) ; foreach ( $ indexHeaders as $ value ) { $ curl_headers [ ] = sprintf ( '%s: %s' , $ value [ 0 ] , $ value [ 1 ] ) ; } // setup metadata headers foreach ( $ object -> getMetaData ( ) as $ key => $ value ) { $ curl_headers [ ] = sprintf ( '%s%s: %s' , static :: METADATA_PREFIX , $ key , $ value ) ; } } // set the request headers on the connection $ this -> options [ CURLOPT_HTTPHEADER ] = $ curl_headers ; // dump local headers to start fresh $ this -> headers = [ ] ; return $ this ; }
Prepares the request headers

@return $this
Prepares the request headers