Skip to content

Commit 352ad48

Browse files
committed
:octocat: CurlHandle/CurlMultiClient rework
1 parent 0effae2 commit 352ad48

9 files changed

+499
-627
lines changed

Diff for: examples/curl_multi.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151

5252
public function handleResponse(
5353
ResponseInterface $response,
54-
RequestInterface $request,
55-
int $id,
56-
array $curl_info,
54+
RequestInterface $request,
55+
int $id,
56+
array|null $curl_info,
5757
):RequestInterface|null{
5858

5959
// the API returns either 200 or 206 on OK responses
@@ -80,8 +80,9 @@ public function handleResponse(
8080

8181
// create a file for each item in the response (ofc you'd rather put this in a DB)
8282
foreach($json as $item){
83-
$file = $lang.'/'.$item->id;
84-
file_put_contents(__DIR__.'/'.$file.'.json', json_encode($item, (JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)));
83+
$file = sprintf('%s/%s/%s.json', __DIR__, $lang, $item->id);
84+
85+
file_put_contents($file, json_encode($item, (JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)));
8586

8687
echo $file.PHP_EOL;
8788
}

0 commit comments

Comments
 (0)