IpsGatewayFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 10

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 10
dl 0
loc 41
ccs 27
cts 27
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B populateConfig() 0 35 2
1
<?php
2
3
namespace PayumTW\Ips;
4
5
use Payum\Core\GatewayFactory;
6
use PayumTW\Ips\Action\SyncAction;
7
use PayumTW\Ips\Action\NotifyAction;
8
use PayumTW\Ips\Action\StatusAction;
9
use PayumTW\Ips\Action\CaptureAction;
10
use Payum\Core\Bridge\Spl\ArrayObject;
11
use PayumTW\Ips\Action\ConvertPaymentAction;
12
use PayumTW\Ips\Action\Api\CreateTransactionAction;
13
use PayumTW\Ips\Action\Api\GetTransactionDataAction;
14
15
class IpsGatewayFactory extends GatewayFactory
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 1
    protected function populateConfig(ArrayObject $config)
21
    {
22 1
        $config->defaults([
23 1
            'payum.factory_name' => 'ips',
24 1
            'payum.factory_title' => 'Ips',
25 1
            'payum.action.capture' => new CaptureAction(),
26 1
            'payum.action.nofity' => new NotifyAction(),
27 1
            'payum.action.sync' => new SyncAction(),
28 1
            'payum.action.status' => new StatusAction(),
29 1
            'payum.action.convert_payment' => new ConvertPaymentAction(),
30
31 1
            'payum.action.api.create_transaction' => new CreateTransactionAction(),
32 1
            'payum.action.api.get_transaction_data' => new GetTransactionDataAction(),
33 1
        ]);
34
35 1
        if (false == $config['payum.api']) {
36 1
            $config['payum.default_options'] = [
37 1
                'Version' => 'v1.0.0',
38 1
                'MerCode' => null,
39 1
                'MerKey' => null,
40 1
                'MerName' => null,
41 1
                'Account' => null,
42 1
                'sandbox' => true,
43
            ];
44
45 1
            $config->defaults($config['payum.default_options']);
46 1
            $config['payum.required_options'] = ['MerCode', 'MerKey', 'Account'];
47
48 1
            $config['payum.api'] = function (ArrayObject $config) {
49 1
                $config->validateNotEmpty($config['payum.required_options']);
50
51 1
                return new Api((array) $config, $config['payum.http_client'], $config['httplug.message_factory']);
52
            };
53 1
        }
54 1
    }
55
}
56