@@ -29,10 +29,10 @@ public static function fake(array $queue): void
2929 self ::$ queue = $ queue ;
3030 }
3131
32- public static function check (string $ url , ?string $ userAgent = null ): CheckData
32+ public static function check (string $ url , ?string $ userAgent = null , ? int $ connectTimeout = null , ? int $ timeout = null ): CheckData
3333 {
3434 try {
35- $ response = (new self ())->getResponse ($ url , $ userAgent );
35+ $ response = (new self ())->getResponse ($ url , $ userAgent, $ connectTimeout , $ timeout );
3636
3737 if (!$ response instanceof ResponseInterface) {
3838 return new CheckData (
@@ -81,16 +81,16 @@ private function getConfig(): array
8181 /**
8282 * @throws GuzzleException
8383 */
84- private function getResponse (string $ url , ?string $ userAgent = null ): ?ResponseInterface
84+ private function getResponse (string $ url , ?string $ userAgent = null , ? int $ connectTimeout = null , ? int $ timeout = null ): ?ResponseInterface
8585 {
8686 $ response = null ;
8787
8888 $ client = (new Client ($ this ->getConfig ()));
8989
9090 try {
9191 $ client ->get ($ url , [
92- 'connect_timeout ' => 2 ,
93- 'timeout ' => 5 ,
92+ 'connect_timeout ' => $ connectTimeout ?? 2 ,
93+ 'timeout ' => $ timeout ?? 5 ,
9494 'headers ' => [
9595 'User-Agent ' => implode (' ' , array_filter ([
9696 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) ' ,
0 commit comments