Skip to content

Commit 7acf3cd

Browse files
authored
Merge pull request #16 from Glennmen/fix-env-var
Allow PloiAPI token to be passed via constructor
2 parents 1fce6bc + 8b19c8c commit 7acf3cd

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

app/Services/PloiAPI.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class PloiAPI
1515

1616
public mixed $headers;
1717

18-
public function __construct()
18+
public function __construct(?string $token = null)
1919
{
20-
$this->apiKey = config('ploi.token');
20+
$this->apiKey = $token ?? config('ploi.token');
2121
$this->apiUrl = Config::get('ploi.api_url');
2222
$this->headers = [
2323
'User-Agent' => 'Ploi CLI',
@@ -116,7 +116,7 @@ private function mergeResponseData(array $existing, mixed $new): array
116116
return $existing;
117117
}
118118

119-
if (!is_array($new)) {
119+
if (! is_array($new)) {
120120
$new = [$new];
121121
}
122122

0 commit comments

Comments
 (0)