|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright © Thomas Klein, All rights reserved. |
|
4
|
|
|
* See LICENSE bundled with this library for license details. |
|
5
|
|
|
*/ |
|
6
|
|
|
declare(strict_types=1); |
|
7
|
|
|
|
|
8
|
|
|
namespace Zoho\Desk\Client; |
|
9
|
|
|
|
|
10
|
|
|
use Zoho\OAuth\Utility\ZohoOAuthConstants; |
|
11
|
|
|
use Zoho\Desk\Api\Metadata; |
|
12
|
|
|
use function array_merge; |
|
13
|
|
|
|
|
14
|
|
|
final class ConfigProvider implements ConfigProviderInterface |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* @var string[] |
|
18
|
|
|
*/ |
|
19
|
|
|
private array $settings; |
|
20
|
|
|
|
|
21
|
|
|
public function __construct(array $settings) |
|
22
|
|
|
{ |
|
23
|
|
|
$this->settings = $settings; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function get(): array |
|
27
|
|
|
{ |
|
28
|
|
|
return array_merge($this->defaultSettings(), $this->settings); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
private function defaultSettings(): array |
|
32
|
|
|
{ |
|
33
|
|
|
return [ |
|
34
|
|
|
ZohoOAuthConstants::CLIENT_ID => null, |
|
35
|
|
|
ZohoOAuthConstants::CLIENT_SECRET => null, |
|
36
|
|
|
ZohoOAuthConstants::REDIRECT_URL => null, |
|
37
|
|
|
Metadata::API_FIELD_CURRENT_USER_EMAIL => null, |
|
38
|
|
|
Metadata::ORG_ID => null, |
|
39
|
|
|
ZohoOAuthConstants::SANDBOX => null, |
|
40
|
|
|
Metadata::API_FIELD_BASE_URL => Metadata::API_ENDPOINT_US, |
|
41
|
|
|
Metadata::API_FIELD_VERSION => Metadata::API_VERSION, |
|
42
|
|
|
ZohoOAuthConstants::ACCESS_TYPE => Metadata::ACCESS_TYPE, |
|
43
|
|
|
ZohoOAuthConstants::IAM_URL => null, |
|
44
|
|
|
ZohoOAuthConstants::TOKEN_PERSISTENCE_PATH => null, |
|
45
|
|
|
]; |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
|