| Conditions | 3 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | public function assembly(Rocket $rocket, Closure $next): Rocket |
||
| 18 | { |
||
| 19 | /* @var Rocket $rocket */ |
||
| 20 | $rocket = $next($rocket); |
||
| 21 | |||
| 22 | Logger::debug('[Alipay][ResponsePlugin] 插件开始装载', ['rocket' => $rocket]); |
||
| 23 | |||
| 24 | $destination = $rocket->getDestination(); |
||
| 25 | $payload = $rocket->getPayload(); |
||
| 26 | $resultKey = str_replace('.', '_', $payload->get('method')).'_response'; |
||
| 27 | |||
| 28 | if (should_do_http_request($rocket->getDirection()) && $destination instanceof Collection) { |
||
| 29 | $rocket->setDestination(new Collection(array_merge( |
||
| 30 | ['_sign' => $destination->get('sign', '')], |
||
| 31 | $destination->get($resultKey, $destination->all()) |
||
| 32 | ))); |
||
| 33 | } |
||
| 34 | |||
| 35 | Logger::info('[Alipay][ResponsePlugin] 插件装载完毕', ['rocket' => $rocket]); |
||
| 36 | |||
| 37 | return $rocket; |
||
| 38 | } |
||
| 40 |