作者 竞泽

feat:format all

... ... @@ -22,7 +22,8 @@ class Config
string $baseUri = '',
float $timeout = 30.0,
bool $enableMock = false
) {
)
{
$this->appKey = $appKey;
$this->appSecret = $appSecret;
$this->baseUri = $baseUri;
... ...
... ... @@ -2,11 +2,11 @@
namespace Lackoxygen\TiktokShop\Mock;
use App\Pkgs\TiktokShop\Attribute\Config;
use App\Pkgs\TiktokShop\Attribute\Request;
use App\Pkgs\TiktokShop\Exception\ClientException;
use App\Pkgs\TiktokShop\Exception\MockException;
use App\Pkgs\TiktokShop\Utils\Json;
use Lackoxygen\TiktokShop\Attribute\Config;
use Lackoxygen\TiktokShop\Attribute\Request;
use Lackoxygen\TiktokShop\Exception\ClientException;
use Lackoxygen\TiktokShop\Exception\MockException;
use Lackoxygen\TiktokShop\Util\Json;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Psr7\Response;
... ...
... ... @@ -3,7 +3,7 @@
namespace Lackoxygen\TiktokShop\Passage;
use Lackoxygen\TiktokShop\Attribute\Config;
use Lackoxygen\TiktokShop\Exception\{ClientException, ExpiredException};
use Lackoxygen\TiktokShop\Exception\ClientException;
class PassageProxy
{
... ... @@ -25,7 +25,6 @@ class PassageProxy
/**
* @throws ClientException
* @throws ExpiredException
*/
public function __call($name, $arguments): ResultSet
{
... ...
... ... @@ -49,14 +49,14 @@ class ResultSet
{
$array = $this->toArray();
return (string) $array['message'] ?? '';
return (string)$array['message'] ?? '';
}
public function getData(): array
{
$array = $this->toArray();
return (array) Arr::get($array, 'data', []);
return (array)Arr::get($array, 'data', []);
}
public function get(string $key, $default = '')
... ...
... ... @@ -40,7 +40,7 @@ class SessionMemory
public static function persistence()
{
$key = static::$cachePrefix.'keepalive_table';
$key = static::$cachePrefix . 'keepalive_table';
try {
if (func_get_args()) {
static::cache()->set($key, func_get_arg(0));
... ...
... ... @@ -59,7 +59,7 @@ class TiktokShop
public static function newConfig(array $options): Config
{
return new Config(Arr::get($options, 'app_key'), Arr::get($options, 'app_secret'),
Arr::get($options, 'base_uri'), (float) Arr::get($options, 'timeout'), Arr::get($options, 'enable_mock'));
Arr::get($options, 'base_uri'), (float)Arr::get($options, 'timeout'), Arr::get($options, 'enable_mock'));
}
/**
... ...
... ... @@ -22,7 +22,7 @@ class TiktokShopProvider extends ServiceProvider
public function boot()
{
if ($this->app->runningInConsole()) {
$configPath = __DIR__.'/../publish/tiktok.shop.php';
$configPath = __DIR__ . '/../publish/tiktok.shop.php';
$this->publishes([
$configPath => config_path('tiktok.shop.php')
], 'lackoxygen-tiktok-shop');
... ...
... ... @@ -27,7 +27,7 @@ class Client
*/
protected function serviceToPath(string $service): string
{
return '/'.ltrim(Str::replace('.', '/', $service), '/');
return '/' . ltrim(Str::replace('.', '/', $service), '/');
}
/**
... ... @@ -107,7 +107,7 @@ class Client
$retry = new Retry(function () use ($request, $options) {
return $this->guzzleHttp($request->getConfig())
->request($request->getMethod(), $request->getPath() ? : $this->serviceToPath($request->getService()),
->request($request->getMethod(), $request->getPath() ?: $this->serviceToPath($request->getService()),
$options);
}, function ($e) {
return $e instanceof ConnectException;
... ...
... ... @@ -43,8 +43,7 @@ class Retry
throw new ClientException($e);
}
$waitMilliseconds && usleep($waitMilliseconds * 1000);
}
finally {
} finally {
++$attempts;
}
} while ($attempts < $retries);
... ...