1 | <?php |
||
23 | class Config implements ConfigInterface |
||
24 | { |
||
25 | /** |
||
26 | * The current package version. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $version = 1.3; |
||
31 | |||
32 | /** |
||
33 | * The Saudi National Address API key. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $apiKey; |
||
38 | |||
39 | /** |
||
40 | * The Saudi National Address API subscription. |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $apiSubscription; |
||
45 | |||
46 | /** |
||
47 | * Enabling Cache |
||
48 | * |
||
49 | * @var bool |
||
50 | */ |
||
51 | protected $cache = true; |
||
52 | |||
53 | /** |
||
54 | * Constructor. |
||
55 | * |
||
56 | * @param string $apiKey |
||
57 | * @param string $apiSubscription |
||
58 | */ |
||
59 | public function __construct($apiKey, $apiSubscription = 'Development', $cache = false) |
||
65 | |||
66 | /** |
||
67 | * Get env Variable. |
||
68 | * |
||
69 | * @param string $name |
||
70 | * @param string|null $default |
||
71 | * @return string|null |
||
72 | */ |
||
73 | private static function getEnvVariable($name, $default = null) |
||
85 | |||
86 | /** |
||
87 | * Returns the package version. |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | public function getVersion() |
||
95 | |||
96 | /** |
||
97 | * Returns the Saudi National Address API key. |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | public function getApiKey() |
||
105 | |||
106 | /** |
||
107 | * Sets the Saudi National Address API key. |
||
108 | * |
||
109 | * @param string $apiKey |
||
110 | * @return Config |
||
111 | */ |
||
112 | public function setApiKey($apiKey) |
||
118 | |||
119 | /** |
||
120 | * Returns the Saudi National Address API subscription type. |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | public function getApiSubscription() |
||
128 | |||
129 | /** |
||
130 | * Sets the Saudi National Address API subscription type. |
||
131 | * |
||
132 | * @param string $apiSubscription |
||
133 | * @return Config |
||
134 | */ |
||
135 | public function setApiSubscription($apiSubscription) |
||
141 | |||
142 | /** |
||
143 | * Returns the cache status. |
||
144 | * |
||
145 | * @return bool |
||
146 | */ |
||
147 | public function getCache() |
||
151 | |||
152 | /** |
||
153 | * Sets the cache status. |
||
154 | * |
||
155 | * @param bool $cache |
||
156 | * @return Config |
||
157 | */ |
||
158 | public function setCache($cache) |
||
164 | } |
||
165 |