File tree 2 files changed +8
-9
lines changed
2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 2
2
<?php
3
3
4
4
use GuzzleHttp \Client ;
5
+ use GuzzleHttp \Promise \Utils as PromiseUtils ;
6
+ use GuzzleHttp \Utils ;
5
7
use Psr \Http \Message \ResponseInterface ;
6
8
use Symfony \Component \VarExporter \VarExporter ;
7
- use function GuzzleHttp \json_decode ;
8
- use function GuzzleHttp \Promise \all ;
9
9
10
10
require_once __DIR__ . '/../vendor/autoload.php ' ;
11
11
@@ -14,11 +14,11 @@ $httpQueue = [];
14
14
$ responses = [];
15
15
16
16
$ unwrap = function (ResponseInterface $ response ) {
17
- return json_decode ($ response ->getBody ()->getContents ());
17
+ return Utils:: jsonDecode ($ response ->getBody ()->getContents ());
18
18
};
19
19
20
20
echo "Fetching country list... \r\n" ;
21
- $ countries = explode ('~ ' , json_decode (
21
+ $ countries = explode ('~ ' , Utils:: jsonDecode (
22
22
$ httpClient ->get ('/ssl-address/data ' )->getBody ()->getContents ()
23
23
)->countries );
24
24
@@ -27,7 +27,7 @@ foreach ($countries as $i => $country) {
27
27
$ httpQueue [] = $ httpClient ->getAsync ("/ssl-address/data/ {$ country }" )->then ($ unwrap );
28
28
29
29
if (($ i !== 0 && $ i % 10 === 0 ) || $ i + 1 === count ($ countries )) {
30
- $ responses = array_merge ($ responses , all ($ httpQueue )->wait ());
30
+ $ responses = array_merge ($ responses , PromiseUtils:: all ($ httpQueue )->wait ());
31
31
$ httpQueue = [];
32
32
usleep (500000 );
33
33
}
Original file line number Diff line number Diff line change 24
24
"illuminate/validation" : " ^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0"
25
25
},
26
26
"require-dev" : {
27
- "guzzlehttp/guzzle" : " ^6.5 || ^7.0.1" ,
28
- "mockery/mockery" : " ^1.3" ,
29
- "phpunit/phpunit" : " ^8.5 || ^9.0 || ^10.0" ,
30
- "symfony/var-exporter" : " ^4.0"
27
+ "guzzlehttp/guzzle" : " ^7.8" ,
28
+ "phpunit/phpunit" : " ^8.5 || ^9.6 || ^10.5" ,
29
+ "symfony/var-exporter" : " ^4.0 || ^5.0 || ^6.0 || ^7.0"
31
30
},
32
31
"autoload" : {
33
32
"psr-4" : {
You can’t perform that action at this time.
0 commit comments