Config::getUrl()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace SafeCrow;
4
5
/**
6
 * Class Config
7
 * @package SafeCrow
8
 */
9
class Config
10
{
11
    /**
12
     * @var string
13
     */
14
    const URL_PROD = 'https://www.safecrow.ru';
15
16
    /**
17
     * @var string
18
     */
19
    const URL_DEV = 'https://dev.safecrow.ru';
20
21
    /**
22
     * @var string
23
     */
24
    private $key;
25
26
    /**
27
     * @var string
28
     */
29
    private $secret;
30
31
    /**
32
     * @var bool
33
     */
34
    private $dev;
35
36
    /**
37
     * @var array
38
     */
39
    private $headers;
40
41
    /**
42
     * Config constructor.
43
     * @param string $key
44
     * @param string $secret
45
     * @param bool   $dev
46
     */
47
    public function __construct(string $key, string $secret, bool $dev = true)
48
    {
49
        $this->key = $key;
50
        $this->secret = $secret;
51
        $this->dev = $dev;
52
        $this->headers = [
53
            'Content-Type' => 'application/json',
54
            'Accept' => 'application/json'
55
        ];
56
    }
57
58
    /**
59
     * @return string
60
     */
61
    public function getKey(): string
62
    {
63
        return $this->key;
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    public function getSecret(): string
70
    {
71
        return $this->secret;
72
    }
73
74
    /**
75
     * @return bool
76
     */
77
    public function isDev(): bool
78
    {
79
        return $this->dev;
80
    }
81
82
    /**
83
     * @return string
84
     */
85
    public function getUrl(): string
86
    {
87
        return $this->isDev() ? self::URL_DEV : self::URL_PROD;
88
    }
89
90
    /**
91
     * @return array
92
     */
93
    public function getHeaders(): array
94
    {
95
        return $this->headers;
96
    }
97
}
98