ResponseInvokeStringPlugin   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A assembly() 0 14 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Plugin\Alipay\V2;
6
7
use Closure;
8
use GuzzleHttp\Psr7\Response;
9
use Yansongda\Artful\Contract\PluginInterface;
10
use Yansongda\Artful\Logger;
11
use Yansongda\Artful\Rocket;
12
use Yansongda\Supports\Arr;
13
14
class ResponseInvokeStringPlugin 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('[Alipay][ResponseInvokeStringPlugin] 插件开始装载', ['rocket' => $rocket]);
22
23
        $response = new Response(200, [], Arr::query($rocket->getPayload()->all()));
24
25
        $rocket->setDestination($response);
26
27
        Logger::info('[Alipay][ResponseInvokeStringPlugin] 插件装载完毕', ['rocket' => $rocket]);
28
29
        return $rocket;
30
    }
31
}
32