Completed
Push — master ( 0f907a...866d23 )
by Andrii
02:30
created

Gateway   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A getDefaultParameters() 0 7 1
A getPurse() 0 4 1
A setPurse() 0 4 1
A getSecret() 0 4 1
A setSecret() 0 4 1
A purchase() 0 4 1
A completePurchase() 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;
13
14
use Omnipay\Common\AbstractGateway;
15
16
/**
17
 * Gateway for PayPal.
18
 */
19
class Gateway extends AbstractGateway
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24 1
    public function getName()
25
    {
26 1
        return 'PayPal';
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 29
    public function getDefaultParameters()
33
    {
34
        return [
35 29
            'purse'     => '',
36 29
            'testMode'  => false,
37 29
        ];
38
    }
39
40
    /**
41
     * Get the merchant purse.
42
     *
43
     * @return string merchant purse - email associated with the merchant account.
44
     */
45 2
    public function getPurse()
46
    {
47 2
        return $this->getParameter('purse');
48
    }
49
50
    /**
51
     * Set the merchant purse.
52
     *
53
     * @param string $value merchant purse - email associated with the merchant account.
54
     * @return self
55
     */
56 29
    public function setPurse($value)
57
    {
58 29
        return $this->setParameter('purse', $value);
59
    }
60
61
    /**
62
     * Get the merchant secret. Actually not used.
63
     *
64
     * @return string merchant secret
65
     */
66 1
    public function getSecret()
67
    {
68 1
        return $this->getParameter('secret');
69
    }
70
71
    /**
72
     * Set the merchant secret. Actually not used.
73
     *
74
     * @param string $value merchant secret
75
     * @return self
76
     */
77 29
    public function setSecret($value)
78
    {
79 29
        return $this->setParameter('secret', $value);
80
    }
81
82
    /**
83
     * @param array $parameters
84
     *
85
     * @return \Omnipay\PayPal\Message\PurchaseRequest
86
     */
87 3
    public function purchase(array $parameters = [])
88
    {
89 3
        return $this->createRequest('\Omnipay\PayPal\Message\PurchaseRequest', $parameters);
90
    }
91
92
    /**
93
     * @param array $parameters
94
     *
95
     * @return \Omnipay\PayPal\Message\CompletePurchaseRequest
96
     */
97 3
    public function completePurchase(array $parameters = [])
98
    {
99 3
        return $this->createRequest('\Omnipay\PayPal\Message\CompletePurchaseRequest', $parameters);
100
    }
101
}
102