@@ -34,12 +34,12 @@ class Response implements ResponseInterface {
34
34
/** @var null|callable */
35
35
private $ exitCallback ;
36
36
private Deferred $ deferred ;
37
- private CurlInterface $ curl ;
38
37
39
38
public function __construct (
40
39
private ?int $ statusCode = null ,
41
40
?ResponseHeaders $ headers = null ,
42
41
private readonly ?Request $ request = null ,
42
+ private readonly ?CurlInterface $ curl = null ,
43
43
) {
44
44
$ this ->headers = $ headers ?? new ResponseHeaders ();
45
45
$ this ->stream = new Stream ();
@@ -322,6 +322,7 @@ public function awaitJson(int $depth = 512, int $options = 0):JsonObject {
322
322
return $ jsonObject ;
323
323
}
324
324
325
+ /** @param int<1, max> $depth */
325
326
private function jsonFromResponseText (string $ responseText , int $ depth = 512 , int $ options = 0 ):JsonObject {
326
327
$ builder = new JsonObjectBuilder ($ depth , $ options );
327
328
return $ builder ->fromJsonString ($ responseText );
@@ -361,23 +362,4 @@ private function getPromise():Promise {
361
362
362
363
return $ this ->deferred ->getPromise ();
363
364
}
364
-
365
- private function checkIntegrity (?string $ integrity , string $ contents ):void {
366
- if (is_null ($ integrity )) {
367
- return ;
368
- }
369
-
370
- [$ algo , $ hash ] = explode ("- " , $ integrity );
371
-
372
- $ availableAlgos = hash_algos ();
373
- if (!in_array ($ algo , $ availableAlgos )) {
374
- throw new InvalidIntegrityAlgorithmException ($ algo );
375
- }
376
-
377
- $ hashedContents = hash ($ algo , $ contents );
378
-
379
- if ($ hashedContents !== $ hash ) {
380
- throw new IntegrityMismatchException ();
381
- }
382
- }
383
365
}
0 commit comments