You are here

public function OAuthRequest::set_parameter in jQuery social stream 8

Same name and namespace in other branches
  1. 8.2 src/Twitter/OAuthRequest.php \Drupal\jquery_social_stream\Twitter\OAuthRequest::set_parameter()
1 call to OAuthRequest::set_parameter()
OAuthRequest::sign_request in src/Twitter/OAuthRequest.php

File

src/Twitter/OAuthRequest.php, line 94

Class

OAuthRequest

Namespace

Drupal\jquery_social_stream\Twitter

Code

public function set_parameter($name, $value, $allow_duplicates = true) {
  if ($allow_duplicates && isset($this->parameters[$name])) {

    // We have already added parameter(s) with this name, so add to the list
    if (is_scalar($this->parameters[$name])) {

      // This is the first duplicate, so transform scalar (string)
      // into an array so we can add the duplicates
      $this->parameters[$name] = array(
        $this->parameters[$name],
      );
    }
    $this->parameters[$name][] = $value;
  }
  else {
    $this->parameters[$name] = $value;
  }
}