Passed
Pull Request — master (#501)
by Songda
03:29
created

CreatePlugin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getUri() 0 3 1
A doSomething() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Plugin\Wechat\Fund\Transfer;
6
7
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
8
use Yansongda\Pay\Rocket;
9
10
class CreatePlugin extends GeneralPlugin
11
{
12
    /**
13
     * @throws \Yansongda\Pay\Exception\ContainerDependencyException
14
     * @throws \Yansongda\Pay\Exception\ContainerException
15
     * @throws \Yansongda\Pay\Exception\ServiceNotFoundException
16
     */
17
    protected function doSomething(Rocket $rocket): void
18
    {
19
        $config = get_wechat_config($rocket->getParams());
20
21
        $wechatId = [
22
            'appid' => $config->get('mp_app_id'),
23
        ];
24
25
        $rocket->mergePayload($wechatId);
26
    }
27
28
    protected function getUri(Rocket $rocket): string
29
    {
30
        return 'v3/transfer/batches';
31
    }
32
}
33