for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Shortcut\Douyin;
use Yansongda\Artful\Contract\ShortcutInterface;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Plugin\AddPayloadBodyPlugin;
use Yansongda\Artful\Plugin\ParserPlugin;
use Yansongda\Artful\Plugin\StartPlugin;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Plugin\Douyin\V1\Pay\AddPayloadSignaturePlugin;
use Yansongda\Pay\Plugin\Douyin\V1\Pay\AddRadarPlugin;
use Yansongda\Pay\Plugin\Douyin\V1\Pay\Mini\QueryPlugin as MiniQueryPlugin;
use Yansongda\Pay\Plugin\Douyin\V1\Pay\ResponsePlugin;
use Yansongda\Supports\Str;
class QueryShortcut implements ShortcutInterface
{
/**
* @throws InvalidParamsException
*/
public function getPlugins(array $params): array
$action = Str::camel($params['_action'] ?? 'default').'Plugins';
if (method_exists($this, $action)) {
return $this->{$action}();
}
throw new InvalidParamsException(Exception::PARAMS_SHORTCUT_ACTION_INVALID, "Query action [{$action}] not supported");
protected function defaultPlugins(): array
return $this->miniPlugins();
protected function miniPlugins(): array
return [
StartPlugin::class,
MiniQueryPlugin::class,
AddPayloadSignaturePlugin::class,
AddPayloadBodyPlugin::class,
AddRadarPlugin::class,
ResponsePlugin::class,
ParserPlugin::class,
];