EzshipGatewayFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 9

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 9
dl 0
loc 38
ccs 23
cts 23
cp 1
rs 10
c 0
b 0
f 0

1 Method

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