CompletePurchase   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 14
c 2
b 0
f 0
dl 0
loc 32
rs 10
wmc 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getPaymentId() 0 2 2
A setPaymentId() 0 2 1
A getEndpoint() 0 3 2
A getInvoiceId() 0 2 2
A getHttpMethod() 0 2 1
A getData() 0 9 2
1
<?php
2
3
namespace Omnipay\Myfatoorah\Message;
4
5
class CompletePurchase extends AbstractRequest {
6
7
    public function getPaymentId() {
8
        return isset($_GET['paymentId']) ? $_GET['paymentId'] : '';
9
    }
10
11
    public function getInvoiceId() {
12
        return isset($_GET['invoiceid']) ? $_GET['invoiceid'] : '';
13
    }
14
15
    public function setPaymentId($value) {
16
        return $this->setParameter('paymentId', $value);
17
    }
18
19
    public function getData() {
20
        if($this->getPaymentId()){
21
            $data['Key']     = $this->getPaymentId();
0 ignored issues
show
Comprehensibility Best Practice introduced by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.
Loading history...
22
            $data['KeyType'] = "paymentId";
23
        }else{
24
            $data['Key']     = $this->getInvoiceId();
25
            $data['KeyType'] = "invoiceid";
26
        }
27
        return $data;
28
    }
29
30
    public function getHttpMethod() {
31
        return 'POST';
32
    }
33
34
    public function getEndpoint() {
35
        $endpoint = $this->getTestMode() ? $this->sandboxEndpoint : $this->productionEndpoint;
36
        return $endpoint . '/v2/getpaymentstatus';
37
    }
38
39
}
40