Completed
Push — master ( 905377...e98615 )
by Gregorio
02:42
created

CreateGatewayRequest::setConfig()   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

Importance

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