| Total Complexity | 5 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | class ResponsePlugin implements PluginInterface |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @throws InvalidResponseException |
||
| 21 | */ |
||
| 22 | public function assembly(Rocket $rocket, Closure $next): Rocket |
||
| 23 | { |
||
| 24 | /* @var Rocket $rocket */ |
||
| 25 | $rocket = $next($rocket); |
||
| 26 | |||
| 27 | Logger::debug('[Wechat][ResponsePlugin] 插件开始装载', ['rocket' => $rocket]); |
||
| 28 | |||
| 29 | $rocket->setDestination($this->validateResponse($rocket)); |
||
| 30 | |||
| 31 | Logger::info('[Wechat][ResponsePlugin] 插件装载完毕', ['rocket' => $rocket]); |
||
| 32 | |||
| 33 | return $rocket; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @throws InvalidResponseException |
||
| 38 | */ |
||
| 39 | protected function validateResponse(Rocket $rocket): null|array|Collection|MessageInterface |
||
| 49 | } |
||
| 50 | } |
||
| 51 |