GatewayConfig::getConfig()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 2
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Recca0120\LaravelPayum\Model;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Payum\Core\Model\GatewayConfigInterface;
7
8
class GatewayConfig extends Model implements GatewayConfigInterface
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $table = 'payum_gateway_configs';
14
15
    /**
16
     * getGatewayName.
17
     *
18
     * @return string
19
     */
20 1
    public function getGatewayName()
21
    {
22 1
        return $this->getAttribute('gatewayName');
23
    }
24
25
    /**
26
     * setGatewayName.
27
     *
28
     * @param string $gatewayName
29
     */
30 1
    public function setGatewayName($gatewayName)
31
    {
32 1
        $this->setAttribute('gatewayName', $gatewayName);
33 1
    }
34
35
    /**
36
     * getFactoryName.
37
     *
38
     * @return string
39
     */
40 1
    public function getFactoryName()
41
    {
42 1
        return $this->getAttribute('factoryName');
43
    }
44
45
    /**
46
     * setFactoryName.
47
     *
48
     * @param string $name
49
     */
50 1
    public function setFactoryName($name)
51
    {
52 1
        $this->setAttribute('factoryName', $name);
53 1
    }
54
55
    /**
56
     * getConfig.
57
     *
58
     * @return array
59
     */
60 1
    public function getConfig()
61
    {
62 1
        return json_decode($this->getAttribute('config') ?: '{}', true);
63
    }
64
65
    /**
66
     * setConfig.
67
     *
68
     * @param array $config
69
     */
70 1
    public function setConfig(array $config)
71
    {
72 1
        $this->setAttribute('config', json_encode($config));
73 1
    }
74
}
75