PayPal\Core\PayPalHttpConfig::setHeaders PHP Method

setHeaders() public method

Set Headers
public setHeaders ( array $headers = [] )
$headers array
    public function setHeaders(array $headers = array())
    {
        $this->headers = $headers;
    }

Usage Example

Esempio n. 1
0
 /**
  * @param PayPalHttpConfig $httpConfig
  * @param string                    $request
  * @param mixed                     $options
  * @return mixed|void
  * @throws PayPalConfigurationException
  * @throws PayPalInvalidCredentialException
  * @throws PayPalMissingCredentialException
  */
 public function handle($httpConfig, $request, $options)
 {
     $config = $this->apiContext->getConfig();
     $httpConfig->setUrl(rtrim(trim($this->_getEndpoint($config)), '/') . (isset($options['path']) ? $options['path'] : ''));
     $headers = array("User-Agent" => PayPalUserAgent::getValue(PayPalConstants::SDK_NAME, PayPalConstants::SDK_VERSION), "Authorization" => "Basic " . base64_encode($options['clientId'] . ":" . $options['clientSecret']), "Accept" => "*/*");
     $httpConfig->setHeaders($headers);
     // Add any additional Headers that they may have provided
     $headers = $this->apiContext->getRequestHeaders();
     foreach ($headers as $key => $value) {
         $httpConfig->addHeader($key, $value);
     }
 }
All Usage Examples Of PayPal\Core\PayPalHttpConfig::setHeaders