| Total Complexity | 3 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class ResponseHtmlPlugin implements PluginInterface |
||
| 15 | { |
||
| 16 | public function assembly(Rocket $rocket, Closure $next): Rocket |
||
| 17 | { |
||
| 18 | /* @var Rocket $rocket */ |
||
| 19 | $rocket = $next($rocket); |
||
| 20 | |||
| 21 | Logger::debug('[Unipay][ResponseHtmlPlugin] 插件开始装载', ['rocket' => $rocket]); |
||
| 22 | |||
| 23 | $radar = $rocket->getRadar(); |
||
| 24 | |||
| 25 | $response = $this->buildHtml($radar->getUri()->__toString(), $rocket->getPayload()); |
||
| 26 | |||
| 27 | $rocket->setDestination($response); |
||
| 28 | |||
| 29 | Logger::info('[Unipay][ResponseHtmlPlugin] 插件装载完毕', ['rocket' => $rocket]); |
||
| 30 | |||
| 31 | return $rocket; |
||
| 32 | } |
||
| 33 | |||
| 34 | protected function buildHtml(string $endpoint, ?Collection $payload): Response |
||
| 44 | } |
||
| 45 | } |
||
| 46 |