Completed
Push — master ( e98615...4a03fb )
by Gregorio
02:16
created

CreateGatewayRequest::getEndpoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.125

Importance

Changes 0
Metric Value
dl 0
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
/**
6
 * @method Response send()
7
 */
8
class CreateGatewayRequest extends AbstractRequest
9
{
10
11 6
    public function getType()
12
    {
13 6
        return $this->getParameter('type');
14
    }
15
16 6
    public function setType($value)
17
    {
18 6
        return $this->setParameter('type', $value);
19
    }
20
21 6
    public function getConfig()
22
    {
23 6
        return $this->getParameter('config');
24
    }
25
26 6
    public function setConfig($value)
27
    {
28 6
        return $this->setParameter('config', $value);
29
    }
30
31
    /**
32
     * @return array
33
     * @throws \Omnipay\Common\Exception\InvalidRequestException
34
     */
35 6
    public function getData()
36
    {
37 6
        $this->validate('type');
38
39 6
        $config = (array) ($this->getConfig() ?: array());
40 6
        $config['gateway_type'] = $this->getType();
41
42
        return array(
43 6
            'gateway' => $config,
44 6
        );
45
    }
46
47
    /**
48
     * @return string
49
     */
50 6
    public function getEndpoint()
51
    {
52 6
        return $this->endpoint . 'gateways';
53
    }
54
55
56
}
57