PurchaseRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 2
cbo 2
dl 0
loc 30
ccs 19
cts 19
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 22 1
A sendData() 0 4 1
1
<?php
2
3
/*
4
 * PayPal driver for Omnipay PHP payment library
5
 *
6
 * @link      https://github.com/hiqdev/omnipay-paypal
7
 * @package   omnipay-paypal
8
 * @license   MIT
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace Omnipay\PayPal\Message;
13
14
class PurchaseRequest extends AbstractRequest
15 3
{
16
    public function getData()
17 3
    {
18 3
        $this->validate(
19 3
            'purse',
20 3
            'amount', 'currency', 'description',
21
            'returnUrl', 'cancelUrl', 'notifyUrl'
22
        );
23
24 3
        return [
25 3
            'cmd'           => '_xclick',
26 3
            'bn'            => 'PP-BuyNowBF:btn_paynowCC_LG.gif:NonHostedGuest',
27 3
            'item_name'     => $this->getDescription(),
28 3
            'amount'        => $this->getAmount(),
29 3
            'currency_code' => strtoupper($this->getCurrency()),
30 3
            'business'      => $this->getPurse(),
31 3
            'notify_url'    => $this->getNotifyUrl(),
32 3
            'return'        => $this->getReturnUrl(),
33 3
            'cancel_return' => $this->getCancelUrl(),
34 3
            'item_number'   => $this->getTransactionId(),
35
            'charset'       => 'utf-8',
36
        ];
37
    }
38 2
39
    public function sendData($data)
40 2
    {
41
        return $this->response = new PurchaseResponse($this, $data);
42
    }
43
}
44