作者 竞泽

style:cs

... ... @@ -23,7 +23,8 @@
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "^9.5.10"
"phpunit/phpunit": "^9.5.10",
"friendsofphp/php-cs-fixer": "^3.7"
},
"extra": {
"laravel": {
... ...
... ... @@ -22,8 +22,7 @@ class Config
string $baseUri = '',
float $timeout = 30.0,
bool $enableMock = false
)
{
) {
$this->appKey = $appKey;
$this->appSecret = $appSecret;
$this->baseUri = $baseUri;
... ...
... ... @@ -149,4 +149,3 @@ class Request
$this->path = $path;
}
}
... ...
... ... @@ -5,7 +5,6 @@ namespace Lackoxygen\TiktokShop\Command;
use Lackoxygen\TiktokShop\Supervisor\Session\SessionHeart;
use Illuminate\Console\Command;
class RefreshToken extends Command
{
/**
... ...
... ... @@ -4,5 +4,4 @@ namespace Lackoxygen\TiktokShop\Exception;
class ClientException extends \Exception
{
}
... ...
... ... @@ -4,5 +4,4 @@ namespace Lackoxygen\TiktokShop\Exception;
class MockException extends \Exception
{
}
... ...
... ... @@ -4,5 +4,4 @@ namespace Lackoxygen\TiktokShop\Exception;
class RetryException extends ClientException
{
}
... ...
... ... @@ -15,7 +15,8 @@ use Illuminate\Support\Arr;
class Mock
{
protected string $passage, $method;
protected string $passage;
protected string $method;
protected Annotation $annotation;
... ... @@ -24,7 +25,7 @@ class Mock
$this->passage = $passage;
$this->method = $method;
$this->annotation = new Annotation;
$this->annotation = new Annotation();
}
... ...
... ... @@ -61,5 +61,4 @@ interface ShopInterface
* @return ResultSet
*/
public function addressList(array $params);
}
... ...
... ... @@ -17,7 +17,7 @@ class SessionHeart
public static function new(): SessionHeart
{
if (is_null(static::$sessionHeart)) {
static::$sessionHeart = new static;
static::$sessionHeart = new static();
}
return static::$sessionHeart;
... ...
... ... @@ -58,8 +58,13 @@ 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'));
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')
);
}
/**
... ...
... ... @@ -15,11 +15,12 @@ class Builder
protected Config $config;
protected string $passage, $method;
protected string $passage;
protected string $method;
public function __construct(Config $config, string $passage, string $method)
{
$this->request = new Request;
$this->request = new Request();
$this->config = $config;
$this->request->setConfig($config);
$this->passage = $passage;
... ...
... ... @@ -17,7 +17,7 @@ class Client
{
public static function create(): Client
{
return new self;
return new self();
}
/**
... ... @@ -37,7 +37,7 @@ class Client
*/
protected function signature(Request $request): ?string
{
$sig = new Signature;
$sig = new Signature();
$sig->setTimestamp($request->getTimestamp());
$sig->setMethod($request->getService());
$sig->setAppKey($request->getConfig()->getAppKey());
... ... @@ -107,8 +107,11 @@ class Client
$retry = new Retry(function () use ($request, $options) {
return $this->guzzleHttp($request->getConfig())
->request($request->getMethod(), $request->getPath() ?: $this->serviceToPath($request->getService()),
$options);
->request(
$request->getMethod(),
$request->getPath() ?: $this->serviceToPath($request->getService()),
$options
);
}, function ($e) {
return $e instanceof ConnectException;
});
... ...