Completed
Push — master ( 5fb2c0...ccfcd1 )
by Matt
02:36
created

Configuration::getCertificateVerify()   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 0
crap 1
1
<?php
2
3
namespace CommerceGuys\AuthNet;
4
5
class Configuration
6
{
7
    private $apiLogin;
8
    private $transactionKey;
9
    private $sandbox;
10
    private $requestMode = 'xml';
11
    private $certificateVerify;
12
13 16
    public function __construct(array $config)
14
    {
15
        // @todo validate and throw invalid argument exception if missing.
16 16
        $this->apiLogin = $config['api_login'];
17 16
        $this->transactionKey = $config['transaction_key'];
18 16
        $this->sandbox = $config['sandbox'];
19
20 16
        if (isset($config['request_mode'])) {
21
            $this->requestMode = $config['request_mode'];
22
        }
23
24 16
        if (isset($config['certificate_verify'])) {
25 13
          $this->certificateVerify = $config['certificate_verify'];
26 13
        } else {
27 3
          $this->certificateVerify = __DIR__ . '/../resources/cert.pem';
28
        }
29 16
    }
30
31
    /**
32
     * @return mixed
33
     */
34 13
    public function getApiLogin()
35
    {
36 13
        return $this->apiLogin;
37
    }
38
39
    /**
40
     * @param mixed $apiLogin
41
     * @return Configuration
42
     */
43 1
    public function setApiLogin($apiLogin)
44
    {
45 1
        $this->apiLogin = $apiLogin;
46 1
        return $this;
47
    }
48
49
    /**
50
     * @return mixed
51
     */
52 13
    public function getTransactionKey()
53
    {
54 13
        return $this->transactionKey;
55
    }
56
57
    /**
58
     * @param mixed $transactionKey
59
     * @return Configuration
60
     */
61 1
    public function setTransactionKey($transactionKey)
62
    {
63 1
        $this->transactionKey = $transactionKey;
64 1
        return $this;
65
    }
66
67
    /**
68
     * @return mixed
69
     */
70 10
    public function getSandbox()
71
    {
72 10
        return $this->sandbox;
73
    }
74
75
    /**
76
     * @param mixed $sandbox
77
     * @return Configuration
78
     */
79 1
    public function setSandbox($sandbox)
80
    {
81 1
        $this->sandbox = $sandbox;
82 1
        return $this;
83
    }
84
85
    /**
86
     * @return mixed|string
87
     */
88 9
    public function getRequestMode()
89
    {
90 9
        return $this->requestMode;
91
    }
92
93
    /**
94
     * @param mixed|string $requestMode
95
     * @return Configuration
96
     */
97
    public function setRequestMode($requestMode)
98
    {
99
        $this->requestMode = $requestMode;
100
        return $this;
101
    }
102
103
    /**
104
     * @return mixed|string
105
     */
106 9
    public function getCertificateVerify()
107
    {
108 9
        return $this->certificateVerify;
109
    }
110
111
    /**
112
     * @param mixed|string $value
113
     * @return Configuration
114
     */
115
    public function setCertificateVerify($value)
116
    {
117
        $this->certificateValue = $value;
0 ignored issues
show
Bug introduced by
The property certificateValue does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
118
        return $this;
119
    }
120
}
121