Skip to content

Commit

Permalink
Added baseUrl as construct option (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
andSemin authored Nov 8, 2024
1 parent 17de7d9 commit 4dbd13d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/GreenSMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class GreenSMS extends MethodInvoker
protected $version;
protected $useTokenForRequests = true;
protected $camelCaseResponse = false;
protected $baseUrl = null;

public function __construct($options = [])
{
Expand Down Expand Up @@ -53,6 +54,10 @@ public function __construct($options = [])
if (array_key_exists('version', $options)) {
$this->version = $options['version'];
}

if (array_key_exists('baseUrl', $options)) {
$this->baseUrl = $options['baseUrl'];
}

if (!$this->token) {
$this->token = getenv('GREENSMS_TOKEN');
Expand All @@ -73,7 +78,7 @@ public function __construct($options = [])

$sharedOptions = [
'useTokenForRequests' => $this->useTokenForRequests,
'baseUrl' => Url::baseUrl(),
'baseUrl' => $this->baseUrl ?? Url::baseUrl(),
'restClient' => $this->getHttpClient([
'useCamelCase' => $this->camelCaseResponse
]),
Expand Down

0 comments on commit 4dbd13d

Please sign in to comment.