AuthorizeRequest::getEndpoint()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1.125

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 4
cp 0.5
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1.125
1
<?php
2
3
namespace Omnipay\Spreedly\Message;
4
5
use Omnipay\Spreedly\Concerns\HasOwnerData;
6
use Omnipay\Spreedly\Message\Concerns\HasGateway;
7
use Omnipay\Spreedly\Message\Concerns\HasGatewaySpecificFields;
8
use Omnipay\Spreedly\Message\Concerns\HasPaymentMethodData;
9
10
/**
11
 * @method Response send()
12
 */
13 View Code Duplication
class AuthorizeRequest extends AbstractRequest
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
    use HasGateway, HasPaymentMethodData, HasGatewaySpecificFields, HasOwnerData;
16
17
    /**
18
     * @return array
19
     * @throws \Omnipay\Common\Exception\InvalidCreditCardException
20
     * @throws \Omnipay\Common\Exception\InvalidRequestException
21
     * @throws \Omnipay\Spreedly\Exception\InvalidPaymentMethodException
22
     */
23 6
    public function getData()
24
    {
25 6
        $this->validate('amount', 'currency');
26
27 6
        $data = $this->validateAndGetPaymentMethodData();
28
29 6
        $data = $this->fillGatewaySpecificFields($data);
30
31 6
        $data = $this->fillExistingParameters($data, array(
32 6
            'amount' => 'amount_integer',
33 6
            'currency_code' => 'currency',
34 6
            'email' => 'email',
35 6
            'retain_on_success' => 'retain_on_success',
36 6
        ));
37
38 6
        return array('transaction' => $data);
39
    }
40
41
    /**
42
     * @return string
43
     * @throws \Omnipay\Common\Exception\InvalidRequestException
44
     */
45 6
    public function getEndpoint()
46
    {
47 6
        return $this->getGatewayEndpoint() . 'authorize';
48
    }
49
}
50