RequestConfig::isTest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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