正在显示
13 个修改的文件
包含
64 行增加
和
65 行删除
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | return [ | 3 | return [ |
| 4 | - 'app_key' => env('TIKTOK_APP_KEY', ''), | ||
| 5 | - 'app_secret' => env('TIKTOK_APP_SECRET', ''), | 4 | + 'app_key' => env('TIKTOK_APP_KEY', ''), |
| 5 | + 'app_secret' => env('TIKTOK_APP_SECRET', ''), | ||
| 6 | 'enable_mock' => env('TIKTOK_ENABLE_MOCK', false), | 6 | 'enable_mock' => env('TIKTOK_ENABLE_MOCK', false), |
| 7 | - 'base_uri' => env('TIKTOK_BASE_URI', 'https://openapi-sandbox.jinritemai.com'), | ||
| 8 | - 'timeout' => env('TIKTOK_TIMEOUT', 30), | 7 | + 'base_uri' => env('TIKTOK_BASE_URI', 'https://openapi-sandbox.jinritemai.com'), |
| 8 | + 'timeout' => env('TIKTOK_TIMEOUT', 30), | ||
| 9 | ]; | 9 | ]; |
| @@ -20,18 +20,19 @@ class Config | @@ -20,18 +20,19 @@ class Config | ||
| 20 | string $appKey = '', | 20 | string $appKey = '', |
| 21 | string $appSecret = '', | 21 | string $appSecret = '', |
| 22 | string $baseUri = '', | 22 | string $baseUri = '', |
| 23 | - float $timeout = 30.0, | ||
| 24 | - bool $enableMock = false | ||
| 25 | - ) { | ||
| 26 | - $this->appKey = $appKey; | ||
| 27 | - $this->appSecret = $appSecret; | ||
| 28 | - $this->baseUri = $baseUri; | ||
| 29 | - $this->timeout = $timeout; | 23 | + float $timeout = 30.0, |
| 24 | + bool $enableMock = false | ||
| 25 | + ) | ||
| 26 | + { | ||
| 27 | + $this->appKey = $appKey; | ||
| 28 | + $this->appSecret = $appSecret; | ||
| 29 | + $this->baseUri = $baseUri; | ||
| 30 | + $this->timeout = $timeout; | ||
| 30 | $this->enableMock = $enableMock; | 31 | $this->enableMock = $enableMock; |
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | /** | 34 | /** |
| 34 | - * @param mixed $appKey | 35 | + * @param mixed $appKey |
| 35 | */ | 36 | */ |
| 36 | public function setAppKey(string $appKey): void | 37 | public function setAppKey(string $appKey): void |
| 37 | { | 38 | { |
| @@ -47,7 +48,7 @@ class Config | @@ -47,7 +48,7 @@ class Config | ||
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | /** | 50 | /** |
| 50 | - * @param mixed $appSecret | 51 | + * @param mixed $appSecret |
| 51 | */ | 52 | */ |
| 52 | public function setAppSecret($appSecret): void | 53 | public function setAppSecret($appSecret): void |
| 53 | { | 54 | { |
| @@ -63,7 +64,7 @@ class Config | @@ -63,7 +64,7 @@ class Config | ||
| 63 | } | 64 | } |
| 64 | 65 | ||
| 65 | /** | 66 | /** |
| 66 | - * @param bool $enableMock | 67 | + * @param bool $enableMock |
| 67 | */ | 68 | */ |
| 68 | public function setEnableMock(bool $enableMock): void | 69 | public function setEnableMock(bool $enableMock): void |
| 69 | { | 70 | { |
| @@ -80,7 +81,7 @@ class Config | @@ -80,7 +81,7 @@ class Config | ||
| 80 | 81 | ||
| 81 | 82 | ||
| 82 | /** | 83 | /** |
| 83 | - * @param string $baseUri | 84 | + * @param string $baseUri |
| 84 | */ | 85 | */ |
| 85 | public function setBaseUri(string $baseUri): void | 86 | public function setBaseUri(string $baseUri): void |
| 86 | { | 87 | { |
| @@ -96,7 +97,7 @@ class Config | @@ -96,7 +97,7 @@ class Config | ||
| 96 | } | 97 | } |
| 97 | 98 | ||
| 98 | /** | 99 | /** |
| 99 | - * @param string $accessToken | 100 | + * @param string $accessToken |
| 100 | */ | 101 | */ |
| 101 | public function setAccessToken(string $accessToken): void | 102 | public function setAccessToken(string $accessToken): void |
| 102 | { | 103 | { |
| @@ -112,7 +113,7 @@ class Config | @@ -112,7 +113,7 @@ class Config | ||
| 112 | } | 113 | } |
| 113 | 114 | ||
| 114 | /** | 115 | /** |
| 115 | - * @param float $timeout | 116 | + * @param float $timeout |
| 116 | */ | 117 | */ |
| 117 | public function setTimeout(float $timeout): void | 118 | public function setTimeout(float $timeout): void |
| 118 | { | 119 | { |
| @@ -2,11 +2,11 @@ | @@ -2,11 +2,11 @@ | ||
| 2 | 2 | ||
| 3 | namespace Lackoxygen\TiktokShop\Mock; | 3 | namespace Lackoxygen\TiktokShop\Mock; |
| 4 | 4 | ||
| 5 | -use App\Pkgs\TiktokShop\Attribute\Config; | ||
| 6 | -use App\Pkgs\TiktokShop\Attribute\Request; | ||
| 7 | -use App\Pkgs\TiktokShop\Exception\ClientException; | ||
| 8 | -use App\Pkgs\TiktokShop\Exception\MockException; | ||
| 9 | -use App\Pkgs\TiktokShop\Utils\Json; | 5 | +use Lackoxygen\TiktokShop\Attribute\Config; |
| 6 | +use Lackoxygen\TiktokShop\Attribute\Request; | ||
| 7 | +use Lackoxygen\TiktokShop\Exception\ClientException; | ||
| 8 | +use Lackoxygen\TiktokShop\Exception\MockException; | ||
| 9 | +use Lackoxygen\TiktokShop\Util\Json; | ||
| 10 | use GuzzleHttp\Client; | 10 | use GuzzleHttp\Client; |
| 11 | use GuzzleHttp\Exception\GuzzleException; | 11 | use GuzzleHttp\Exception\GuzzleException; |
| 12 | use GuzzleHttp\Psr7\Response; | 12 | use GuzzleHttp\Psr7\Response; |
| @@ -13,12 +13,12 @@ abstract class Passage | @@ -13,12 +13,12 @@ abstract class Passage | ||
| 13 | protected Builder $builder; | 13 | protected Builder $builder; |
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| 16 | - * @param Config $config | ||
| 17 | - * @param string $method | 16 | + * @param Config $config |
| 17 | + * @param string $method | ||
| 18 | */ | 18 | */ |
| 19 | public function __construct(Config $config, string $method) | 19 | public function __construct(Config $config, string $method) |
| 20 | { | 20 | { |
| 21 | - $this->config = $config; | 21 | + $this->config = $config; |
| 22 | $this->builder = Builder::create($config, get_class($this), $method); | 22 | $this->builder = Builder::create($config, get_class($this), $method); |
| 23 | } | 23 | } |
| 24 | 24 |
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | namespace Lackoxygen\TiktokShop\Passage; | 3 | namespace Lackoxygen\TiktokShop\Passage; |
| 4 | 4 | ||
| 5 | use Lackoxygen\TiktokShop\Attribute\Config; | 5 | use Lackoxygen\TiktokShop\Attribute\Config; |
| 6 | -use Lackoxygen\TiktokShop\Exception\{ClientException, ExpiredException}; | 6 | +use Lackoxygen\TiktokShop\Exception\ClientException; |
| 7 | 7 | ||
| 8 | class PassageProxy | 8 | class PassageProxy |
| 9 | { | 9 | { |
| @@ -25,7 +25,6 @@ class PassageProxy | @@ -25,7 +25,6 @@ class PassageProxy | ||
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * @throws ClientException | 27 | * @throws ClientException |
| 28 | - * @throws ExpiredException | ||
| 29 | */ | 28 | */ |
| 30 | public function __call($name, $arguments): ResultSet | 29 | public function __call($name, $arguments): ResultSet |
| 31 | { | 30 | { |
| @@ -49,14 +49,14 @@ class ResultSet | @@ -49,14 +49,14 @@ class ResultSet | ||
| 49 | { | 49 | { |
| 50 | $array = $this->toArray(); | 50 | $array = $this->toArray(); |
| 51 | 51 | ||
| 52 | - return (string) $array['message'] ?? ''; | 52 | + return (string)$array['message'] ?? ''; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | public function getData(): array | 55 | public function getData(): array |
| 56 | { | 56 | { |
| 57 | $array = $this->toArray(); | 57 | $array = $this->toArray(); |
| 58 | 58 | ||
| 59 | - return (array) Arr::get($array, 'data', []); | 59 | + return (array)Arr::get($array, 'data', []); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | public function get(string $key, $default = '') | 62 | public function get(string $key, $default = '') |
| @@ -35,7 +35,7 @@ class SessionHeart | @@ -35,7 +35,7 @@ class SessionHeart | ||
| 35 | 35 | ||
| 36 | public function __destruct() | 36 | public function __destruct() |
| 37 | { | 37 | { |
| 38 | - $watch = false; | 38 | + $watch = false; |
| 39 | $serializes = []; | 39 | $serializes = []; |
| 40 | SessionMemory::each(function (SessionInterface $session) use (&$watch, &$serializes) { | 40 | SessionMemory::each(function (SessionInterface $session) use (&$watch, &$serializes) { |
| 41 | $serializes[] = serialize($session); | 41 | $serializes[] = serialize($session); |
| @@ -40,7 +40,7 @@ class SessionMemory | @@ -40,7 +40,7 @@ class SessionMemory | ||
| 40 | 40 | ||
| 41 | public static function persistence() | 41 | public static function persistence() |
| 42 | { | 42 | { |
| 43 | - $key = static::$cachePrefix.'keepalive_table'; | 43 | + $key = static::$cachePrefix . 'keepalive_table'; |
| 44 | try { | 44 | try { |
| 45 | if (func_get_args()) { | 45 | if (func_get_args()) { |
| 46 | static::cache()->set($key, func_get_arg(0)); | 46 | static::cache()->set($key, func_get_arg(0)); |
| @@ -74,7 +74,7 @@ class Store | @@ -74,7 +74,7 @@ class Store | ||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | /** | 76 | /** |
| 77 | - * @param string $id | 77 | + * @param string $id |
| 78 | */ | 78 | */ |
| 79 | public function setId(string $id): void | 79 | public function setId(string $id): void |
| 80 | { | 80 | { |
| @@ -90,7 +90,7 @@ class Store | @@ -90,7 +90,7 @@ class Store | ||
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | /** | 92 | /** |
| 93 | - * @param string $accessToken | 93 | + * @param string $accessToken |
| 94 | */ | 94 | */ |
| 95 | public function setAccessToken(string $accessToken): void | 95 | public function setAccessToken(string $accessToken): void |
| 96 | { | 96 | { |
| @@ -106,7 +106,7 @@ class Store | @@ -106,7 +106,7 @@ class Store | ||
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | /** | 108 | /** |
| 109 | - * @param string $refreshToken | 109 | + * @param string $refreshToken |
| 110 | */ | 110 | */ |
| 111 | public function setRefreshToken(string $refreshToken): void | 111 | public function setRefreshToken(string $refreshToken): void |
| 112 | { | 112 | { |
| @@ -122,7 +122,7 @@ class Store | @@ -122,7 +122,7 @@ class Store | ||
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | /** | 124 | /** |
| 125 | - * @param Carbon $createdAt | 125 | + * @param Carbon $createdAt |
| 126 | */ | 126 | */ |
| 127 | public function setCreatedAt(Carbon $createdAt): void | 127 | public function setCreatedAt(Carbon $createdAt): void |
| 128 | { | 128 | { |
| @@ -138,7 +138,7 @@ class Store | @@ -138,7 +138,7 @@ class Store | ||
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | /** | 140 | /** |
| 141 | - * @param Carbon $expiredAt | 141 | + * @param Carbon $expiredAt |
| 142 | */ | 142 | */ |
| 143 | public function setExpiredAt(Carbon $expiredAt): void | 143 | public function setExpiredAt(Carbon $expiredAt): void |
| 144 | { | 144 | { |
| @@ -154,7 +154,7 @@ class Store | @@ -154,7 +154,7 @@ class Store | ||
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | /** | 156 | /** |
| 157 | - * @param int $expiresIn | 157 | + * @param int $expiresIn |
| 158 | */ | 158 | */ |
| 159 | public function setExpiresIn(int $expiresIn): void | 159 | public function setExpiresIn(int $expiresIn): void |
| 160 | { | 160 | { |
| @@ -170,7 +170,7 @@ class Store | @@ -170,7 +170,7 @@ class Store | ||
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | /** | 172 | /** |
| 173 | - * @param array $extras | 173 | + * @param array $extras |
| 174 | */ | 174 | */ |
| 175 | public function setExtras(array $extras): void | 175 | public function setExtras(array $extras): void |
| 176 | { | 176 | { |
| @@ -186,7 +186,7 @@ class Store | @@ -186,7 +186,7 @@ class Store | ||
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | /** | 188 | /** |
| 189 | - * @param int $refreshNum | 189 | + * @param int $refreshNum |
| 190 | */ | 190 | */ |
| 191 | public function setRefreshNum(int $refreshNum): void | 191 | public function setRefreshNum(int $refreshNum): void |
| 192 | { | 192 | { |
| @@ -31,8 +31,8 @@ class TiktokShop | @@ -31,8 +31,8 @@ class TiktokShop | ||
| 31 | * @var array|string[] | 31 | * @var array|string[] |
| 32 | */ | 32 | */ |
| 33 | protected static array $passages = [ | 33 | protected static array $passages = [ |
| 34 | - 'order' => Passage\Order\Order::class, 'shop' => Passage\Shop\Shop::class, | ||
| 35 | - 'product' => Passage\Product\Product::class, 'authorize' => Authorize::class, 'verify' => Verify::class, | 34 | + 'order' => Passage\Order\Order::class, 'shop' => Passage\Shop\Shop::class, |
| 35 | + 'product' => Passage\Product\Product::class, 'authorize' => Authorize::class, 'verify' => Verify::class, | ||
| 36 | 'alliance' => Alliance::class | 36 | 'alliance' => Alliance::class |
| 37 | ]; | 37 | ]; |
| 38 | 38 | ||
| @@ -52,18 +52,18 @@ class TiktokShop | @@ -52,18 +52,18 @@ class TiktokShop | ||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | /** | 54 | /** |
| 55 | - * @param array $options | 55 | + * @param array $options |
| 56 | * | 56 | * |
| 57 | * @return Config | 57 | * @return Config |
| 58 | */ | 58 | */ |
| 59 | public static function newConfig(array $options): Config | 59 | public static function newConfig(array $options): Config |
| 60 | { | 60 | { |
| 61 | return new Config(Arr::get($options, 'app_key'), Arr::get($options, 'app_secret'), | 61 | return new Config(Arr::get($options, 'app_key'), Arr::get($options, 'app_secret'), |
| 62 | - Arr::get($options, 'base_uri'), (float) Arr::get($options, 'timeout'), Arr::get($options, 'enable_mock')); | 62 | + Arr::get($options, 'base_uri'), (float)Arr::get($options, 'timeout'), Arr::get($options, 'enable_mock')); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | /** | 65 | /** |
| 66 | - * @param Config $config | 66 | + * @param Config $config |
| 67 | * | 67 | * |
| 68 | * @return TiktokShop | 68 | * @return TiktokShop |
| 69 | */ | 69 | */ |
| @@ -73,7 +73,7 @@ class TiktokShop | @@ -73,7 +73,7 @@ class TiktokShop | ||
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | /** | 75 | /** |
| 76 | - * @param string $accessToken | 76 | + * @param string $accessToken |
| 77 | * | 77 | * |
| 78 | * @return void | 78 | * @return void |
| 79 | */ | 79 | */ |
| @@ -84,7 +84,7 @@ class TiktokShop | @@ -84,7 +84,7 @@ class TiktokShop | ||
| 84 | 84 | ||
| 85 | /** | 85 | /** |
| 86 | * @param $name | 86 | * @param $name |
| 87 | - * @param array $arguments | 87 | + * @param array $arguments |
| 88 | * | 88 | * |
| 89 | * @return PassageProxy | 89 | * @return PassageProxy |
| 90 | */ | 90 | */ |
| @@ -22,7 +22,7 @@ class TiktokShopProvider extends ServiceProvider | @@ -22,7 +22,7 @@ class TiktokShopProvider extends ServiceProvider | ||
| 22 | public function boot() | 22 | public function boot() |
| 23 | { | 23 | { |
| 24 | if ($this->app->runningInConsole()) { | 24 | if ($this->app->runningInConsole()) { |
| 25 | - $configPath = __DIR__.'/../publish/tiktok.shop.php'; | 25 | + $configPath = __DIR__ . '/../publish/tiktok.shop.php'; |
| 26 | $this->publishes([ | 26 | $this->publishes([ |
| 27 | $configPath => config_path('tiktok.shop.php') | 27 | $configPath => config_path('tiktok.shop.php') |
| 28 | ], 'lackoxygen-tiktok-shop'); | 28 | ], 'lackoxygen-tiktok-shop'); |
| @@ -21,17 +21,17 @@ class Client | @@ -21,17 +21,17 @@ class Client | ||
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | /** | 23 | /** |
| 24 | - * @param string $service | 24 | + * @param string $service |
| 25 | * | 25 | * |
| 26 | * @return string | 26 | * @return string |
| 27 | */ | 27 | */ |
| 28 | protected function serviceToPath(string $service): string | 28 | protected function serviceToPath(string $service): string |
| 29 | { | 29 | { |
| 30 | - return '/'.ltrim(Str::replace('.', '/', $service), '/'); | 30 | + return '/' . ltrim(Str::replace('.', '/', $service), '/'); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | - * @param Request $request | 34 | + * @param Request $request |
| 35 | * | 35 | * |
| 36 | * @return false|string | 36 | * @return false|string |
| 37 | */ | 37 | */ |
| @@ -51,7 +51,7 @@ class Client | @@ -51,7 +51,7 @@ class Client | ||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | /** | 53 | /** |
| 54 | - * @param Request $request | 54 | + * @param Request $request |
| 55 | * | 55 | * |
| 56 | * @return array | 56 | * @return array |
| 57 | */ | 57 | */ |
| @@ -61,10 +61,10 @@ class Client | @@ -61,10 +61,10 @@ class Client | ||
| 61 | Sort::ksort($params); | 61 | Sort::ksort($params); |
| 62 | 62 | ||
| 63 | return [ | 63 | return [ |
| 64 | - 'method' => $request->getService(), 'app_key' => $request->getConfig()->getAppKey(), | 64 | + 'method' => $request->getService(), 'app_key' => $request->getConfig()->getAppKey(), |
| 65 | 'access_token' => $request->getConfig()->getAccessToken(), 'param_json' => Json::marshal($params), | 65 | 'access_token' => $request->getConfig()->getAccessToken(), 'param_json' => Json::marshal($params), |
| 66 | - 'timestamp' => $request->getTimestamp(), 'v' => $request->getV(), 'sign' => $this->signature($request), | ||
| 67 | - 'sign_method' => 'hmac-sha256', | 66 | + 'timestamp' => $request->getTimestamp(), 'v' => $request->getV(), 'sign' => $this->signature($request), |
| 67 | + 'sign_method' => 'hmac-sha256', | ||
| 68 | ]; | 68 | ]; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| @@ -84,7 +84,7 @@ class Client | @@ -84,7 +84,7 @@ class Client | ||
| 84 | 84 | ||
| 85 | 85 | ||
| 86 | /** | 86 | /** |
| 87 | - * @param Request $request | 87 | + * @param Request $request |
| 88 | * | 88 | * |
| 89 | * @return \Psr\Http\Message\ResponseInterface | 89 | * @return \Psr\Http\Message\ResponseInterface |
| 90 | * @throws ClientException | 90 | * @throws ClientException |
| @@ -97,17 +97,17 @@ class Client | @@ -97,17 +97,17 @@ class Client | ||
| 97 | } else { | 97 | } else { |
| 98 | $query = $this->withQuery($request); | 98 | $query = $this->withQuery($request); |
| 99 | } | 99 | } |
| 100 | - $options = [ | 100 | + $options = [ |
| 101 | RequestOptions::HEADERS => [ | 101 | RequestOptions::HEADERS => [ |
| 102 | 'Content-type' => 'application/json' | 102 | 'Content-type' => 'application/json' |
| 103 | ] | 103 | ] |
| 104 | ]; | 104 | ]; |
| 105 | $options[RequestOptions::QUERY] = $query; | 105 | $options[RequestOptions::QUERY] = $query; |
| 106 | - $options[RequestOptions::JSON] = $request->getParams(); | 106 | + $options[RequestOptions::JSON] = $request->getParams(); |
| 107 | 107 | ||
| 108 | $retry = new Retry(function () use ($request, $options) { | 108 | $retry = new Retry(function () use ($request, $options) { |
| 109 | return $this->guzzleHttp($request->getConfig()) | 109 | return $this->guzzleHttp($request->getConfig()) |
| 110 | - ->request($request->getMethod(), $request->getPath() ? : $this->serviceToPath($request->getService()), | 110 | + ->request($request->getMethod(), $request->getPath() ?: $this->serviceToPath($request->getService()), |
| 111 | $options); | 111 | $options); |
| 112 | }, function ($e) { | 112 | }, function ($e) { |
| 113 | return $e instanceof ConnectException; | 113 | return $e instanceof ConnectException; |
| @@ -12,8 +12,8 @@ class Retry | @@ -12,8 +12,8 @@ class Retry | ||
| 12 | protected \Closure $when; | 12 | protected \Closure $when; |
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| 15 | - * @param \Closure $execute | ||
| 16 | - * @param \Closure $when | 15 | + * @param \Closure $execute |
| 16 | + * @param \Closure $when | ||
| 17 | */ | 17 | */ |
| 18 | public function __construct(\Closure $execute, \Closure $when) | 18 | public function __construct(\Closure $execute, \Closure $when) |
| 19 | { | 19 | { |
| @@ -23,8 +23,8 @@ class Retry | @@ -23,8 +23,8 @@ class Retry | ||
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | /** | 25 | /** |
| 26 | - * @param int $retries | ||
| 27 | - * @param int $waitMilliseconds | 26 | + * @param int $retries |
| 27 | + * @param int $waitMilliseconds | ||
| 28 | * | 28 | * |
| 29 | * @return mixed|void | 29 | * @return mixed|void |
| 30 | * @throws ClientException | 30 | * @throws ClientException |
| @@ -33,7 +33,7 @@ class Retry | @@ -33,7 +33,7 @@ class Retry | ||
| 33 | public function __invoke(int $retries = 3, int $waitMilliseconds = 500) | 33 | public function __invoke(int $retries = 3, int $waitMilliseconds = 500) |
| 34 | { | 34 | { |
| 35 | $callback = $this->execute; | 35 | $callback = $this->execute; |
| 36 | - $when = $this->when; | 36 | + $when = $this->when; |
| 37 | $attempts = 0; | 37 | $attempts = 0; |
| 38 | do { | 38 | do { |
| 39 | try { | 39 | try { |
| @@ -43,8 +43,7 @@ class Retry | @@ -43,8 +43,7 @@ class Retry | ||
| 43 | throw new ClientException($e); | 43 | throw new ClientException($e); |
| 44 | } | 44 | } |
| 45 | $waitMilliseconds && usleep($waitMilliseconds * 1000); | 45 | $waitMilliseconds && usleep($waitMilliseconds * 1000); |
| 46 | - } | ||
| 47 | - finally { | 46 | + } finally { |
| 48 | ++$attempts; | 47 | ++$attempts; |
| 49 | } | 48 | } |
| 50 | } while ($attempts < $retries); | 49 | } while ($attempts < $retries); |
-
请 注册 或 登录 后发表评论