Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit acb7af9

Browse files
committed
🚿
1 parent 41514f0 commit acb7af9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

examples/oauth-example-common.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
HTTPClientAbstract, HTTPResponseInterface, TinyCurlClient
1515
};
1616
use chillerlan\Logger\{
17-
Log, LogOptionsTrait, Output\ConsoleLog, Output\LogOutputAbstract
17+
Log, LogOptionsTrait, Output\ConsoleLog
1818
};
1919
use chillerlan\OAuth\{
2020
OAuthOptions, Storage\SessionStorage
@@ -56,11 +56,16 @@
5656

5757
// log
5858
'minLogLevel' => 'debug',
59+
60+
// test http client
61+
'sleep' => 0.25,
5962
];
6063

6164
/** @var \chillerlan\Traits\ContainerInterface $options */
6265
$options = new class($options_arr) extends OAuthOptions{
6366
use DatabaseOptionsTrait, LogOptionsTrait;
67+
68+
protected $sleep;
6469
};
6570

6671
$logger = new Log;
@@ -81,9 +86,9 @@ public function request(string $url, array $params = null, string $method = null
8186
$this->logger->debug('$args', $args);
8287

8388
$response = $this->client->request(...$args);
84-
$this->logger->debug(print_r($response, true));
89+
$this->logger->debug($response->body, (array)$response->headers);
8590

86-
usleep(100000); // flood protection
91+
usleep($this->options->sleep * 1000000);
8792
return $response;
8893
}
8994

0 commit comments

Comments
 (0)