@@ -34,12 +34,12 @@ class Response implements ResponseInterface {
3434 /** @var null|callable */
3535 private $ exitCallback ;
3636 private Deferred $ deferred ;
37- private CurlInterface $ curl ;
3837
3938 public function __construct (
4039 private ?int $ statusCode = null ,
4140 ?ResponseHeaders $ headers = null ,
4241 private readonly ?Request $ request = null ,
42+ private readonly ?CurlInterface $ curl = null ,
4343 ) {
4444 $ this ->headers = $ headers ?? new ResponseHeaders ();
4545 $ this ->stream = new Stream ();
@@ -322,6 +322,7 @@ public function awaitJson(int $depth = 512, int $options = 0):JsonObject {
322322 return $ jsonObject ;
323323 }
324324
325+ /** @param int<1, max> $depth */
325326 private function jsonFromResponseText (string $ responseText , int $ depth = 512 , int $ options = 0 ):JsonObject {
326327 $ builder = new JsonObjectBuilder ($ depth , $ options );
327328 return $ builder ->fromJsonString ($ responseText );
@@ -361,23 +362,4 @@ private function getPromise():Promise {
361362
362363 return $ this ->deferred ->getPromise ();
363364 }
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- }
383365}
0 commit comments