Skip to content

Commit

Permalink
Merge pull request #2 from ymaerschalck/master
Browse files Browse the repository at this point in the history
add testing base url
  • Loading branch information
ymaerschalck authored May 31, 2018
2 parents a155e20 + 870c2fc commit f8fc59d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Services/IMSProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function prepareLaunchRequest(array $extraParameters = array())
{
$parameters = array_merge($this->parameters, $extraParameters);

$oauthRequest = new OauthRequest($parameters, $this->config['url'], $this->config['key'], $this->config['secret']);
$oauthRequest = new OauthRequest($parameters, $this->config['url'], $this->config['baseUrl'], $this->config['key'], $this->config['secret']);
$oauthRequest->signRequest();

return $oauthRequest;
Expand Down
20 changes: 11 additions & 9 deletions Services/Oauth/OAuthRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,28 @@ class OAuthRequest

private $url;

private $baseUrl;

private $key;

private $secret;

/**
* OauthProvider constructor.
*
* @param $parameters
* @param $method
* @param $url
* @param $key
* @param $secret
* @param $parameters
* @param $url
* @param $baseUrl
* @param $key
* @param $secret
* @param string $method
*/
public function __construct($parameters, $url, $key, $secret, $method = 'POST')
public function __construct($parameters, $url, $baseUrl = null, $key, $secret, $method = 'POST')
{
$this->parameters = $parameters;
$this->method = $method;
$this->url = $url;
$this->baseUrl = ($baseUrl) ? $baseUrl : $url;
$this->key = $key;
$this->secret = $secret;
}
Expand Down Expand Up @@ -83,9 +87,7 @@ public function getBaseString()

public function getNormalizedUrl()
{
$endpoint_stripped = str_replace('www.', '', $this->url);
$parts = parse_url($endpoint_stripped);

$parts = parse_url($this->baseUrl);
$port = @$parts['port'];
$scheme = $parts['scheme'];
$host = $parts['host'];
Expand Down

0 comments on commit f8fc59d

Please sign in to comment.