You are here

function OAuthRequestSigner::__construct in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.2 lib/oauth-php/library/OAuthRequestSigner.php \OAuthRequestSigner::__construct()

* Construct the request to be signed. Parses or appends the parameters in the params url. * When you supply an params array, then the params should not be urlencoded. * When you supply a string, then it is assumed it is of the type application/x-www-form-urlencoded * *

Parameters

string request url: * @param string method PUT, GET, POST etc. * @param mixed params string (for urlencoded data, or array with name/value pairs) * @param string body optional body for PUT and/or POST requests

Overrides OAuthRequest::__construct

1 call to OAuthRequestSigner::__construct()
OAuthRequester::__construct in lib/oauth-php/library/OAuthRequester.php
* Construct a new request signer. Perform the request with the doRequest() method below. * * A request can have either one file or a body, not both. * * The files array consists of arrays: * - file the filename/path containing the data…
1 method overrides OAuthRequestSigner::__construct()
OAuthRequester::__construct in lib/oauth-php/library/OAuthRequester.php
* Construct a new request signer. Perform the request with the doRequest() method below. * * A request can have either one file or a body, not both. * * The files array consists of arrays: * - file the filename/path containing the data…

File

lib/oauth-php/library/OAuthRequestSigner.php, line 57

Class

OAuthRequestSigner

Code

function __construct($request, $method = null, $params = null, $body = null) {
  $this->store = OAuthStore::instance();
  if (is_string($params)) {
    parent::__construct($request, $method, $params);
  }
  else {
    parent::__construct($request, $method);
    if (is_array($params)) {
      foreach ($params as $name => $value) {
        $this
          ->setParam($name, $value);
      }
    }
  }

  // With put/ post we might have a body (not for application/x-www-form-urlencoded requests)
  if (strcasecmp($method, 'PUT') == 0 || strcasecmp($method, 'POST') == 0) {
    $this
      ->setBody($body);
  }
}