| Total Complexity | 6 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | class ScanShortcut implements ShortcutInterface |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @throws \Yansongda\Pay\Exception\InvalidParamsException |
||
| 20 | */ |
||
| 21 | public function getPlugins(array $params): array |
||
| 22 | { |
||
| 23 | $typeMethod = Str::studly($params['_type'] ?? 'default').'Plugins'; |
||
| 24 | |||
| 25 | if (method_exists($this, $typeMethod)) { |
||
| 26 | return $this->{$typeMethod}(); |
||
| 27 | } |
||
| 28 | |||
| 29 | throw new InvalidParamsException(Exception::SHORTCUT_MULTI_TYPE_ERROR, "Scan type [$typeMethod] not supported"); |
||
| 30 | } |
||
| 31 | |||
| 32 | public function defaultPlugins(): array |
||
| 33 | { |
||
| 34 | return [ |
||
| 35 | ScanNormalPlugin::class, |
||
| 36 | ]; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function preAuthPlugins(): array |
||
| 40 | { |
||
| 41 | return [ |
||
| 42 | ScanPreAuthPlugin::class, |
||
| 43 | ]; |
||
| 44 | } |
||
| 45 | |||
| 46 | public function preOrderPlugins(): array |
||
| 47 | { |
||
| 48 | return [ |
||
| 49 | ScanPreOrderPlugin::class, |
||
| 50 | ]; |
||
| 51 | } |
||
| 52 | |||
| 53 | public function feePlugins(): array |
||
| 57 | ]; |
||
| 58 | } |
||
| 59 | } |
||
| 60 |