Completed
Branch master (eebe0d)
by Gregorio
02:31 queued 50s
created

UpdatePaymentMethodRequest::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 12
cts 12
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Omnipay\Spreedly\Message;
4
use Omnipay\Spreedly\Concerns\HasOwnerData;
5
6
/**
7
 * @method Response send()
8
 */
9
class UpdatePaymentMethodRequest extends AbstractPaymentMethodRequest
10
{
11
    use HasOwnerData;
12
13
    /**
14
     * @return array
15
     * @throws \Omnipay\Common\Exception\InvalidRequestException
16
     */
17 6
    public function getData()
18
    {
19 6
        $this->validate('payment_method_token');
20
21 6
        $data = $this->fillExistingParameters(array(), array(
22 6
            'allow_blank_name' => 'allow_blank_name',
23 6
            'allow_expired_date' => 'allow_expired_date',
24 6
            'allow_blank_date' => 'allow_blank_date',
25 6
            'first_name' => 'first_name',
26 6
            'last_name' => 'last_name',
27 6
            'email' => 'email',
28 6
            'data' => 'extra',
29 6
        ));
30
31 6
        return array('payment_method' => $data);
32
    }
33
34
    /**
35
     * @return string
36
     */
37 6
    public function getEndpoint()
38
    {
39 6
        return $this->endpoint . 'payment_methods/' . $this->getPaymentMethodToken();
40
    }
41
42
    /**
43
     * @return string
44
     */
45 3
    public function getHttpMethod()
46
    {
47 3
        return 'PUT';
48
    }
49
}
50