Completed
Push — master ( 5c8cb6...92357d )
by Dmitry
02:05
created

OmnipayMerchant   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 22
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getWorker() 0 9 2
A prepareData() 0 7 1
1
<?php
2
/**
3
 * Generalization over Omnipay and Payum
4
 *
5
 * @link      https://github.com/hiqdev/php-merchant
6
 * @package   php-merchant
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\merchant\yandex;
12
13
/**
14
 * Yandex Omnipay Merchant class.
15
 */
16
class OmnipayMerchant extends \hiqdev\php\merchant\OmnipayMerchant
17
{
18
    public $requestClass = OmnipayRequest::class;
19
20
    public function getWorker()
21
    {
22
        if ($this->_worker === null) {
23
            $this->_worker = (new \yandexmoney\YandexMoney\GatewayIndividual())
24
                ->initialize($this->prepareData($this->data));
25
        }
26
27
        return $this->_worker;
28
    }
29
30
    public function prepareData(array $data)
31
    {
32
        return array_merge([
33
            'account' => $data['purse'],
34
            'password' => $data['secret'],
35
        ], $data);
36
    }
37
}
38