RestRefundRequest   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 50
c 0
b 0
f 0
wmc 8
lcom 2
cbo 2
ccs 21
cts 21
cp 1
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getEndpoint() 0 4 1
A getHttpMethod() 0 4 1
A getChargeId() 0 4 1
A setChargeId() 0 4 1
A getReason() 0 4 1
A setReason() 0 4 1
A getData() 0 12 1
A createResponse() 0 4 1
1
<?php
2
namespace Omnipay\ZipPay\Message;
3
4
class RestRefundRequest extends AbstractRequest
5
{
6 6
    protected function getEndpoint()
7
    {
8 6
        return parent::getEndpoint() . '/refunds';
9
    }
10
11 6
    public function getHttpMethod()
12
    {
13 6
        return 'POST';
14
    }
15
16 6
    public function getChargeId()
17
    {
18 6
        return $this->getParameter('chargeId');
19
    }
20
21 6
    public function setChargeId($value)
22
    {
23 6
        return $this->setParameter('chargeId', $value);
24
    }
25
26 6
    public function getReason()
27
    {
28 6
        return $this->getParameter('reason');
29
    }
30
31 6
    public function setReason($value)
32
    {
33 6
        return $this->setParameter('reason', $value);
34
    }
35
36 6
    public function getData()
37
    {
38 6
        $this->validate('chargeId', 'amount', 'reason');
39
40 6
        $data = $this->getBaseData();
41
42 6
        $data['charge_id'] = $this->getChargeId();
43 6
        $data['amount'] = $this->getAmount();
44 6
        $data['reason'] = $this->getReason();
45
46 6
        return $data;
47
    }
48
49 6
    protected function createResponse($data, $headers = [], $status = 404)
50
    {
51 6
        return $this->response = new RestRefundResponse($this, $data, $headers, $status);
52
    }
53
}
54