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

OmnipayMerchant::prepareData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 7
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 2
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