作者 竞泽

feat:format all

@@ -22,7 +22,8 @@ class Config @@ -22,7 +22,8 @@ class Config
22 string $baseUri = '', 22 string $baseUri = '',
23 float $timeout = 30.0, 23 float $timeout = 30.0,
24 bool $enableMock = false 24 bool $enableMock = false
25 - ) { 25 + )
  26 + {
26 $this->appKey = $appKey; 27 $this->appKey = $appKey;
27 $this->appSecret = $appSecret; 28 $this->appSecret = $appSecret;
28 $this->baseUri = $baseUri; 29 $this->baseUri = $baseUri;
@@ -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;
@@ -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 = '')
@@ -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));
@@ -59,7 +59,7 @@ class TiktokShop @@ -59,7 +59,7 @@ class TiktokShop
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 /**
@@ -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');
@@ -27,7 +27,7 @@ class Client @@ -27,7 +27,7 @@ class Client
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 /**
@@ -107,7 +107,7 @@ class Client @@ -107,7 +107,7 @@ class Client
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;
@@ -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);