Skip to content

Commit 79f94d1

Browse files
committed
Add #[SensitiveParameter] to apiKey argument
1 parent 628f0f1 commit 79f94d1

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/LaravelScrapingBee.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Ziming\LaravelScrapingBee;
44

5+
use Illuminate\Http\Client\ConnectionException;
56
use Illuminate\Http\Client\Response;
67
use Illuminate\Support\Facades\Http;
78
use Illuminate\Support\Traits\Conditionable;
@@ -17,12 +18,12 @@ final class LaravelScrapingBee
1718
private array $params = [];
1819
private array $headers = [];
1920

20-
public static function make(?string $apiKey = null, ?int $timeout = null): self
21+
public static function make(#[\SensitiveParameter] ?string $apiKey = null, ?int $timeout = null): self
2122
{
2223
return new self($apiKey, $timeout);
2324
}
2425

25-
public function __construct(?string $apiKey = null, ?int $timeout = null)
26+
public function __construct(#[\SensitiveParameter] ?string $apiKey = null, ?int $timeout = null)
2627
{
2728
// If somebody pass '' into the constructor, we should use '' as the api key
2829
// even if it doesn't make sense.
@@ -36,6 +37,9 @@ public function __construct(?string $apiKey = null, ?int $timeout = null)
3637
);
3738
}
3839

40+
/**
41+
* @throws ConnectionException
42+
*/
3943
private function request(string $method, string $url, array $data = [], string $postContentType = 'application/x-www-form-urlencoded; charset=utf-8'): Response
4044
{
4145
// https://www.scrapingbee.com/documentation/#encoding-url

src/LaravelScrapingBeeGoogleSearch.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ final class LaravelScrapingBeeGoogleSearch
1515

1616
private array $params = [];
1717

18-
public static function make(?string $apiKey = null): self
18+
public static function make(#[\SensitiveParameter] ?string $apiKey = null): self
1919
{
2020
return new self($apiKey);
2121
}
2222

23-
public function __construct(?string $apiKey = null, ?int $timeout = null)
23+
public function __construct(#[\SensitiveParameter] ?string $apiKey = null, ?int $timeout = null)
2424
{
2525
// If somebody pass '' into the constructor, we should use '' as the api key
2626
// even if it doesn't make sense.

0 commit comments

Comments
 (0)