Skip to content

Commit 64ac366

Browse files
authoredNov 9, 2022
remove default curl options from class properties
1 parent 39f879c commit 64ac366

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed
 

‎src/Image.php

+7-11
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,6 @@ class Image
3737
*/
3838
private $height;
3939

40-
/**
41-
* @array $curlOptions array
42-
* Default curl options for the Image library
43-
*/
44-
private $curlOptions = [
45-
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0',
46-
CURLOPT_RETURNTRANSFER => 1,
47-
CURLOPT_TIMEOUT => 5,
48-
];
49-
5040
public function __clone()
5141
{
5242
$srcInstance = $this->image;
@@ -314,9 +304,15 @@ public static function fromCurl(string $url, array $curlOptions = [], bool $fail
314304
*/
315305
public function curl(string $url, array $curlOptions = [], bool $failOnError = false): Image
316306
{
307+
$defaultCurlOptions = [
308+
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0',
309+
CURLOPT_RETURNTRANSFER => 1,
310+
CURLOPT_TIMEOUT => 5,
311+
];
312+
317313
$curl = curl_init();
318314
curl_setopt($curl, CURLOPT_URL, $url);
319-
curl_setopt_array($curl, $this->curlOptions + $curlOptions);
315+
curl_setopt_array($curl, $defaultCurlOptions + $curlOptions);
320316

321317
$image = curl_exec($curl);
322318

0 commit comments

Comments
 (0)
Please sign in to comment.