| Total Complexity | 4 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class QueryShortcut implements ShortcutInterface |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @throws \Yansongda\Pay\Exception\InvalidParamsException |
||
| 17 | */ |
||
| 18 | public function getPlugins(array $params): array |
||
| 19 | { |
||
| 20 | $typeMethod = Str::studly($params['_type'] ?? 'default').'Plugins'; |
||
| 21 | |||
| 22 | if (method_exists($this, $typeMethod)) { |
||
| 23 | return $this->{$typeMethod}(); |
||
| 24 | } |
||
| 25 | |||
| 26 | throw new InvalidParamsException(Exception::SHORTCUT_MULTI_TYPE_ERROR, "Query type [$typeMethod] not supported"); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function defaultPlugins(): array |
||
| 30 | { |
||
| 31 | return [ |
||
| 32 | QueryPlugin::class, |
||
| 33 | ]; |
||
| 34 | } |
||
| 35 | |||
| 36 | protected function qrCodePlugins(): array |
||
| 40 | ]; |
||
| 41 | } |
||
| 42 | } |
||
| 43 |