Passed
Pull Request — master (#28)
by Manuel
09:19
created

RequestConfig   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
dl 0
loc 69
rs 10
c 1
b 0
f 0
wmc 8

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getCustomerId() 0 3 1
A getClient() 0 7 2
A getApiKey() 0 3 1
A getApiSecret() 0 3 1
A setClient() 0 5 1
A __construct() 0 6 1
A isTest() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Ticketpark\SaferpayJson\Request;
4
5
use GuzzleHttp\Client;
6
7
final class RequestConfig
8
{
9
    /**
10
     * @var string
11
     */
12
    private $apiKey;
13
14
    /**
15
     * @var string
16
     */
17
    private $apiSecret;
18
19
    /**
20
     * @var string
21
     */
22
    private $customerId;
23
24
    /**
25
     * @var bool
26
     */
27
    private $test;
28
29
    /**
30
     * @var \GuzzleHttp\Client
31
     */
32
    private $client;
33
34
    public function __construct(string $apiKey, string $apiSecret, string $customerId, bool $test = false)
35
    {
36
        $this->apiKey = $apiKey;
37
        $this->apiSecret = $apiSecret;
38
        $this->customerId = $customerId;
39
        $this->test = $test;
40
    }
41
42
    public function getApiKey(): string
43
    {
44
        return $this->apiKey;
45
    }
46
47
    public function getApiSecret(): string
48
    {
49
        return $this->apiSecret;
50
    }
51
52
    public function getCustomerId(): string
53
    {
54
        return $this->customerId;
55
    }
56
57
    public function isTest(): bool
58
    {
59
        return $this->test;
60
    }
61
62
    public function setClient(Client $client): self
63
    {
64
        $this->client = $client;
65
66
        return $this;
67
    }
68
69
    public function getClient(): Client
70
    {
71
        if (null === $this->client) {
72
            return new Client();
73
        }
74
75
        return $this->client;
76
    }
77
}
78