Total Complexity | 5 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class ClientHelper |
||
11 | { |
||
12 | const CLIENT_ENDPOINT = 'montoro'; |
||
13 | |||
14 | private Client $client; |
||
15 | |||
16 | private $encHelper; |
||
17 | |||
18 | public function __construct(Client $client) |
||
19 | { |
||
20 | $this->client = $client; |
||
21 | $storageSecret = Environment::getEnv('MONITORING_STORAGE_SECRET'); |
||
22 | $storageSalt = Environment::getEnv('MONITORING_STORAGE_SALT'); |
||
23 | $this->encHelper = new EncryptionHelper($storageSecret, $storageSalt); |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Builds the full monitoring URL for the client |
||
28 | * @return string |
||
29 | */ |
||
30 | public function getMonitorURL() |
||
31 | { |
||
32 | return Controller::join_links([ |
||
33 | $this->client->BaseURL, |
||
34 | self::CLIENT_ENDPOINT |
||
35 | ]); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Get the API key for the client |
||
40 | * @return false|string |
||
41 | */ |
||
42 | public function getAPIKey() |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Get the encryption secret for the client |
||
49 | * @return false|string |
||
50 | */ |
||
51 | public function getEncryptionSecret() |
||
52 | { |
||
53 | return $this->encHelper->decrypt($this->client->EncSecret); |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * Get the encryption salt for the client |
||
58 | * @return false|string |
||
59 | */ |
||
60 | public function getEncryptionSalt() |
||
63 | } |
||
64 | |||
65 | } |
||
66 |