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

CreateGatewayRequest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 2
cbo 1
dl 0
loc 49
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 4 1
A setType() 0 4 1
A getConfig() 0 4 1
A setConfig() 0 4 1
A getData() 0 11 2
A getEndpoint() 0 4 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