Completed
Push — master ( 18da62...6da1b2 )
by Andrii
16:14
created

OmnipayMerchant::prepareData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
rs 9.4286
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
/*
4
 * Generalization over Omnipay and Payum
5
 *
6
 * @link      https://github.com/hiqdev/php-merchant
7
 * @package   php-merchant
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2015, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hiqdev\php\merchant\paypal;
13
14
/**
15
 * PayPal Omnipay Merchant class.
16
 */
17
class OmnipayMerchant extends \hiqdev\php\merchant\OmnipayMerchant
18
{
19
    /**
20
     * Returns the normalized gateway $name.
21
     *
22
     * @see normalizeGateway
23
     * @param string $name The gateway name. Defaults to `$this->gateway`
24
     * @return string
25
     */
26
    public function getGateway($name = null)
27
    {
28
        $result = parent::getGateway($name);
29
30
        return $result == 'PayPal' ? 'PayPal_Express' : $result;
31
    }
32
33
    public function prepareData(array $data)
34
    {
35
        return array_merge([
36
            'username' => $data['purse'],
37
            'password' => $data['secret'],
38
        ], $data);
39
    }
40
}
41